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

uucore: entries: add documentation

This commit is contained in:
Jan Scheer 2021-06-13 10:12:00 +02:00
parent 60124b8fbd
commit 9af9343745

View file

@ -179,6 +179,13 @@ impl Passwd {
self.inner self.inner
} }
/// This is a wrapper function for `libc::getgrouplist`.
///
/// From: https://man7.org/linux/man-pages/man3/getgrouplist.3.html
/// If the user is a member of more than *ngroups groups, then
/// getgrouplist() returns -1. In this case, the value returned in
/// *ngroups can be used to resize the buffer passed to a further
/// call getgrouplist().
pub fn belongs_to(&self) -> Vec<gid_t> { pub fn belongs_to(&self) -> Vec<gid_t> {
let mut ngroups: c_int = 8; let mut ngroups: c_int = 8;
let mut groups = Vec::with_capacity(ngroups as usize); let mut groups = Vec::with_capacity(ngroups as usize);