From 58b6761db32fe1da4c086480075222f15692d1ab Mon Sep 17 00:00:00 2001 From: Robert Drehmel Date: Thu, 28 Apr 2005 16:11:37 +0000 Subject: [PATCH] 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. --- usr.bin/id/id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);