summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/getgrouplist.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1997-03-11 11:52:33 +0000
committerpeter <peter@FreeBSD.org>1997-03-11 11:52:33 +0000
commit0b3e1277b4e3cc3bb2575162ec238cac00b15a18 (patch)
tree30be23b5b8ddeb71e0495f1655cf455ef58c410f /lib/libc/gen/getgrouplist.c
parent9234fe208b22e039265244d8a518ff096d630a44 (diff)
downloadFreeBSD-src-0b3e1277b4e3cc3bb2575162ec238cac00b15a18.zip
FreeBSD-src-0b3e1277b4e3cc3bb2575162ec238cac00b15a18.tar.gz
Merge from Lite2:
filesystem include updates, duplicate group suppression, cleanups, filesystem whiteout support (unionfs), bidir popen().
Diffstat (limited to 'lib/libc/gen/getgrouplist.c')
-rw-r--r--lib/libc/gen/getgrouplist.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index 702828e..1c2e42d 100644
--- a/lib/libc/gen/getgrouplist.c
+++ b/lib/libc/gen/getgrouplist.c
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getgrouplist.c 8.1 (Berkeley) 6/4/93";
+static char sccsid[] = "@(#)getgrouplist.c 8.2 (Berkeley) 12/8/94";
#endif /* LIBC_SCCS and not lint */
/*
@@ -68,17 +68,15 @@ getgrouplist(uname, agroup, groups, grpcnt)
* Scan the group file to find additional groups.
*/
setgrent();
- while ( (grp = getgrent()) ) {
- for (i = 0; i < ngroups; i++) {
- if (grp->gr_gid == groups[i])
- goto skip;
- }
- if (ngroups >= maxgroups) {
- ret = -1;
- break;
- }
+ while (grp = getgrent()) {
+ if (grp->gr_gid == agroup)
+ continue;
for (i = 0; grp->gr_mem[i]; i++) {
if (!strcmp(grp->gr_mem[i], uname)) {
+ if (ngroups >= maxgroups) {
+ ret = -1;
+ break;
+ }
groups[ngroups++] = grp->gr_gid;
break;
}
OpenPOWER on IntegriCloud