We need to pass NGROUPS + 1 to getgrouplist(3) to display
NGROUPS groups. getgrouplist(3) may put a duplicate group id into the passed array (it sets [0] and [1] to the value of the gid argument), but id_print() sorts them out.
This commit is contained in:
parent
56db316aaa
commit
38dd7daaf5
@ -243,7 +243,7 @@ id_print(struct passwd *pw, int p_euid, int p_egid)
|
||||
uid = pw->pw_uid;
|
||||
gid = pw->pw_gid;
|
||||
|
||||
ngroups = NGROUPS;
|
||||
ngroups = NGROUPS + 1;
|
||||
getgrouplist(pw->pw_name, gid, groups, &ngroups);
|
||||
|
||||
printf("uid=%u(%s)", uid, pw->pw_name);
|
||||
|
Loading…
Reference in New Issue
Block a user