summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-19 19:13:28 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-19 19:13:28 +0000
commitb655c096be986bde2e2ad753149233cde9c92a19 (patch)
tree3c7b05eb8ea1e170cebf47aa33ce86ba2fa16dbc /lib/libc/gen
parentaf5af05906ca4d3f2b32206da4bd5d03ee9f5cba (diff)
repair duplication check
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/getgrouplist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c
index 9ee03354eb9..3a7a7792c85 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 rcsid[] = "$OpenBSD: getgrouplist.c,v 1.6 1997/08/19 16:24:42 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: getgrouplist.c,v 1.7 1997/08/19 19:13:27 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -52,6 +52,7 @@ getgrouplist(uname, agroup, groups, grpcnt)
register struct group *grp;
register int i, ngroups;
int ret, maxgroups;
+ int bail;
ret = 0;
ngroups = 0;
@@ -73,10 +74,10 @@ getgrouplist(uname, agroup, groups, grpcnt)
while ((grp = getgrent())) {
if (grp->gr_gid == agroup)
continue;
- for (i = 0; i < ngroups; i++)
+ for (bail = 0, i = 0; bail == 0 && i < ngroups; i++)
if (groups[i] == grp->gr_gid)
- break;
- if (groups[i] == grp->gr_gid)
+ bail = 1;
+ if (bail)
continue;
for (i = 0; grp->gr_mem[i]; i++) {
if (!strcmp(grp->gr_mem[i], uname)) {