mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
c_types: handle errors from getgroups()/getgrouplist()
This commit is contained in:
parent
d24327b243
commit
d22be16932
1 changed files with 4 additions and 0 deletions
|
@ -13,6 +13,7 @@ use self::libc::funcs::posix88::unistd::getgroups;
|
||||||
|
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
|
use std::io::IoError;
|
||||||
use std::ptr::read;
|
use std::ptr::read;
|
||||||
use std::str::raw::from_c_str;
|
use std::str::raw::from_c_str;
|
||||||
|
|
||||||
|
@ -138,6 +139,9 @@ pub fn group(possible_pw: Option<c_passwd>, nflag: bool) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ngroups < 0 {
|
||||||
|
crash!(1, "{}", IoError::last_error());
|
||||||
|
}
|
||||||
|
|
||||||
unsafe { groups.set_len(ngroups as uint) };
|
unsafe { groups.set_len(ngroups as uint) };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue