diff --git a/src/unistd.rs b/src/unistd.rs index cb6fc29bf8..a9862d37a3 100644 --- a/src/unistd.rs +++ b/src/unistd.rs @@ -1567,16 +1567,8 @@ pub fn getgrouplist(user: &CStr, group: Gid) -> Result> { // BSD systems will still fill the groups buffer with as many // groups as possible, but Linux manpages do not mention this // behavior. - // Linux stores the number of groups found in ngroups. We can - // use that to resize the buffer exactly. - cfg_if! { - if #[cfg(target_os = "linux")] { - groups.reserve_exact(ngroups as usize); - } else { - reserve_double_buffer_size(&mut groups, ngroups_max as usize) - .map_err(|_| Errno::EINVAL)?; - } - } + reserve_double_buffer_size(&mut groups, ngroups_max as usize) + .map_err(|_| Errno::EINVAL)?; } } }