summaryrefslogtreecommitdiff
path: root/lib/libc/gen
diff options
context:
space:
mode:
authorSteve Price <steve@FreeBSD.org>1998-03-01 18:53:09 +0000
committerSteve Price <steve@FreeBSD.org>1998-03-01 18:53:09 +0000
commit92f4c0ce84a1b07d928a1c797e0f0c126ca942da (patch)
tree010758fd4cdb5f59ffa9f8c775824719fa915dae /lib/libc/gen
parent1e5009096a579b62646b544a7420c69351cc2432 (diff)
Notes
Diffstat (limited to 'lib/libc/gen')
-rw-r--r--lib/libc/gen/getnetgrent.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index da6d44d384c8..cc33d1f4e6da 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -286,21 +286,14 @@ static int _listmatch(list, group, len)
while(isspace(*ptr))
ptr++;
- if (strchr(list, ',') == NULL) {
- if (strncmp(ptr, group, glen) == 0) {
+ while (ptr < list + len) {
+ cptr = ptr;
+ while(*ptr != ',' && *ptr != '\0' && !isspace(*ptr))
+ ptr++;
+ if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr))
return(1);
- }
- } else {
- while (ptr < list + len) {
- cptr = ptr;
- while(*ptr != ',' && !isspace(*ptr))
- ptr++;
- if (strncmp(cptr, group, glen) == 0 &&
- glen == (ptr - cptr))
- return(1);
- while(*ptr == ',' || isspace(*ptr))
- ptr++;
- }
+ while(*ptr == ',' || isspace(*ptr))
+ ptr++;
}
return(0);