summaryrefslogtreecommitdiffstats
path: root/usr.bin/id
diff options
context:
space:
mode:
authorrobert <robert@FreeBSD.org>2005-04-28 16:11:37 +0000
committerrobert <robert@FreeBSD.org>2005-04-28 16:11:37 +0000
commit38dd7daaf5ef4165c5d6c2ca436f49446cfc7301 (patch)
treebb874148729ed352aa5880f9b6ba6bd5e92d9b48 /usr.bin/id
parent56db316aaad6173d3c74d505e9a67df9c89026eb (diff)
downloadFreeBSD-src-38dd7daaf5ef4165c5d6c2ca436f49446cfc7301.zip
FreeBSD-src-38dd7daaf5ef4165c5d6c2ca436f49446cfc7301.tar.gz
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.
Diffstat (limited to 'usr.bin/id')
-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 f6aa3ba..e546e8c 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);
OpenPOWER on IntegriCloud