aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2005-04-28 16:11:37 +0000
committerRobert Drehmel <robert@FreeBSD.org>2005-04-28 16:11:37 +0000
commit58b6761db32fe1da4c086480075222f15692d1ab (patch)
treebb874148729ed352aa5880f9b6ba6bd5e92d9b48
parent68b9b81e792a9108dd161b38165a52a238f620c4 (diff)
downloadsrc-58b6761db32fe1da4c086480075222f15692d1ab.tar.gz
src-58b6761db32fe1da4c086480075222f15692d1ab.zip
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.
Notes
Notes: svn path=/head/; revision=145629
-rw-r--r--usr.bin/id/id.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
index f6aa3ba088b3..e546e8c430f9 100644
--- a/usr.bin/id/id.c
+++ b/usr.bin/id/id.c
@@ -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);