File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -1051,12 +1051,12 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1051
1051
if ret >= 0 {
1052
1052
unsafe { groups. set_len ( ngroups as usize ) } ;
1053
1053
return Ok ( groups) ;
1054
- }
1054
+ } else if ret == -1 {
1055
+ // Returns -1 if ngroups is too small, but does not set errno.
1056
+ // BSD systems will still fill the groups buffer with as many
1057
+ // groups as possible, but Linux manpages do not mention this
1058
+ // behavior.
1055
1059
1056
- // Returns -1 if ngroups is too small, but does not set errno.
1057
- // BSD systems will still fill the groups buffer with as many groups
1058
- // as possible, but Linux manpages do not mention this behavior.
1059
- if ret == -1 {
1060
1060
let cap = groups. capacity ( ) ;
1061
1061
if cap >= ngroups_max as usize {
1062
1062
// We already have the largest capacity we can, give up
You can’t perform that action at this time.
0 commit comments