1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 03:57:44 +00:00

remove unnecessary heap allocation

This commit is contained in:
XXIV 2023-08-31 23:44:45 +03:00 committed by GitHub
parent 44f74c7b25
commit 4f465eb76c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -218,7 +218,7 @@ impl Passwd {
let mut ngroups: c_int = 8;
let mut ngroups_old: c_int;
let mut groups = vec![0; ngroups.try_into().unwrap()];
let name = CString::new(self.name.clone()).unwrap();
let name = CString::new(self.name.as_bytes()).unwrap();
loop {
ngroups_old = ngroups;
if unsafe { getgrouplist(name.as_ptr(), self.gid, groups.as_mut_ptr(), &mut ngroups) }