summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getnetgrent.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index cc04f2f..da6d44d 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -286,14 +286,21 @@ static int _listmatch(list, group, len)
while(isspace(*ptr))
ptr++;
- while (ptr < list + len) {
- cptr = ptr;
- while(*ptr != ',' && !isspace(*ptr))
- ptr++;
- if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr))
+ if (strchr(list, ',') == NULL) {
+ if (strncmp(ptr, group, glen) == 0) {
return(1);
- while(*ptr == ',' || isspace(*ptr))
- ptr++;
+ }
+ } 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++;
+ }
}
return(0);
OpenPOWER on IntegriCloud