Skip to content

Commit 8b9a465

Browse files
committed
unistd: getgroups: Rework variable names
We are preparing the use of `reserve_double_buffer_size` but for this, some logic need to be reworked so we are doing some rename preparing for the next patch which adds its use. Signed-off-by: Otavio Salvador <[email protected]>
1 parent 2fc246c commit 8b9a465

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/unistd.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,21 +1337,21 @@ pub fn setgid(gid: Gid) -> Result<()> {
13371337
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
13381338
pub fn getgroups() -> Result<Vec<Gid>> {
13391339
// First get the number of groups so we can size our Vec
1340-
let ret = unsafe { libc::getgroups(0, ptr::null_mut()) };
1340+
let ngroups = unsafe { libc::getgroups(0, ptr::null_mut()) };
13411341

13421342
// Now actually get the groups. We try multiple times in case the number of
13431343
// groups has changed since the first call to getgroups() and the buffer is
13441344
// now too small.
1345-
let mut groups = Vec::<Gid>::with_capacity(Errno::result(ret)? as usize);
1345+
let mut groups = Vec::<Gid>::with_capacity(Errno::result(ngroups)? as usize);
13461346
loop {
13471347
// FIXME: On the platforms we currently support, the `Gid` struct has
13481348
// the same representation in memory as a bare `gid_t`. This is not
13491349
// necessarily the case on all Rust platforms, though. See RFC 1785.
1350-
let ret = unsafe {
1350+
let ngroups = unsafe {
13511351
libc::getgroups(groups.capacity() as c_int, groups.as_mut_ptr() as *mut gid_t)
13521352
};
13531353

1354-
match Errno::result(ret) {
1354+
match Errno::result(ngroups) {
13551355
Ok(s) => {
13561356
unsafe { groups.set_len(s as usize) };
13571357
return Ok(groups);

0 commit comments

Comments
 (0)