@@ -966,7 +966,7 @@ pub fn getgroups() -> Result<Vec<Gid>> {
966
966
match Errno :: result ( ret) {
967
967
Ok ( s) => {
968
968
unsafe { groups. set_len ( s as usize ) } ;
969
- break
969
+ return Ok ( groups ) ;
970
970
} ,
971
971
Err ( Error :: Sys ( Errno :: EINVAL ) ) => {
972
972
// EINVAL indicates that size was too small, so trigger a
@@ -979,7 +979,6 @@ pub fn getgroups() -> Result<Vec<Gid>> {
979
979
Err ( e) => return Err ( e)
980
980
}
981
981
}
982
- Ok ( groups)
983
982
}
984
983
985
984
/// Set the list of supplementary group IDs for the calling process.
@@ -1049,7 +1048,7 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1049
1048
// BSD systems only return 0 or -1, Linux returns ngroups on success.
1050
1049
if ret >= 0 {
1051
1050
unsafe { groups. set_len ( ngroups as usize ) } ;
1052
- break
1051
+ return Ok ( groups ) ;
1053
1052
}
1054
1053
1055
1054
// Returns -1 if ngroups is too small, but does not set errno.
@@ -1059,7 +1058,7 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1059
1058
let cap = groups. capacity ( ) ;
1060
1059
if cap >= ngroups_max as usize {
1061
1060
// We already have the largest capacity we can, give up
1062
- return Err ( Error :: invalid_argument ( ) )
1061
+ return Err ( Error :: invalid_argument ( ) ) ;
1063
1062
}
1064
1063
1065
1064
// Reserve space for at least ngroups
@@ -1070,8 +1069,6 @@ pub fn getgrouplist(user: &CString, group: Gid) -> Result<Vec<Gid>> {
1070
1069
ngroups = min ( ngroups_max, groups. capacity ( ) as c_int ) ;
1071
1070
}
1072
1071
}
1073
-
1074
- Ok ( groups)
1075
1072
}
1076
1073
1077
1074
/// Initialize the supplementary group access list. Sets the supplementary
0 commit comments