summaryrefslogtreecommitdiff
path: root/src/unistd.rs
diff options
context:
space:
mode:
authorOtavio Salvador <otavio@ossystems.com.br>2019-09-21 19:07:41 -0300
committerOtavio Salvador <otavio@ossystems.com.br>2019-09-25 08:39:28 -0300
commit8b9a465c75fe17182e02d08d06347fb467e4ed5c (patch)
treec2c7b0f13b579c62ceab5204ae2f62d833bdd854 /src/unistd.rs
parent2fc246c37d1bac29d2600680ac2a62bce658e040 (diff)
downloadnix-8b9a465c75fe17182e02d08d06347fb467e4ed5c.zip
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 <otavio@ossystems.com.br>
Diffstat (limited to 'src/unistd.rs')
-rw-r--r--src/unistd.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/unistd.rs b/src/unistd.rs
index ea22f38e..f392b99e 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -1337,21 +1337,21 @@ pub fn setgid(gid: Gid) -> Result<()> {
#[cfg(not(any(target_os = "ios", target_os = "macos")))]
pub fn getgroups() -> Result<Vec<Gid>> {
// First get the number of groups so we can size our Vec
- let ret = unsafe { libc::getgroups(0, ptr::null_mut()) };
+ let ngroups = unsafe { libc::getgroups(0, ptr::null_mut()) };
// Now actually get the groups. We try multiple times in case the number of
// groups has changed since the first call to getgroups() and the buffer is
// now too small.
- let mut groups = Vec::<Gid>::with_capacity(Errno::result(ret)? as usize);
+ let mut groups = Vec::<Gid>::with_capacity(Errno::result(ngroups)? as usize);
loop {
// FIXME: On the platforms we currently support, the `Gid` struct has
// the same representation in memory as a bare `gid_t`. This is not
// necessarily the case on all Rust platforms, though. See RFC 1785.
- let ret = unsafe {
+ let ngroups = unsafe {
libc::getgroups(groups.capacity() as c_int, groups.as_mut_ptr() as *mut gid_t)
};
- match Errno::result(ret) {
+ match Errno::result(ngroups) {
Ok(s) => {
unsafe { groups.set_len(s as usize) };
return Ok(groups);