1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

Merge pull request #5228 from thechampagne/main

uucore: remove unnecessary heap allocation
This commit is contained in:
Sylvestre Ledru 2023-09-01 10:12:05 +02:00 committed by GitHub
commit 4413dd13aa
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) }