summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2008-08-25 22:30:19 +0000
committerderaadt <deraadt@openbsd.org>2008-08-25 22:30:19 +0000
commit908eba582f38a72753a17924e24c5276aaa4870c (patch)
tree447a393d4935dcff5d321f2cb601f34091f70919 /lib/libc
parenttwo spelling fixes from Anathae Townsend; (diff)
downloadwireguard-openbsd-908eba582f38a72753a17924e24c5276aaa4870c.tar.xz
wireguard-openbsd-908eba582f38a72753a17924e24c5276aaa4870c.zip
correct +name handling; schwarze@usta.de
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getgrent.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 6de1ad14f01..7ae8a92a27e 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getgrent.c,v 1.25 2008/06/24 14:29:45 deraadt Exp $ */
+/* $OpenBSD: getgrent.c,v 1.26 2008/08/25 22:30:19 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -356,14 +356,14 @@ grscan(int search, gid_t gid, const char *name, struct group *p_gr,
}
#ifdef YP
if (line[0] == '+') {
- if (foundyp) {
- *foundyp = 1;
- return (NULL);
- }
switch (line[1]) {
case ':':
case '\0':
case '\n':
+ if (foundyp) {
+ *foundyp = 1;
+ return (NULL);
+ }
if (_yp_check(NULL)) {
if (!search) {
__ypmode = YPMODE_FULL;
@@ -414,10 +414,11 @@ grscan(int search, gid_t gid, const char *name, struct group *p_gr,
char *tptr;
tptr = strsep(&bp, ":\n");
+ tptr++;
if (search && name && strcmp(tptr, name))
continue;
__ypmode = YPMODE_NAME;
- grname = strdup(tptr + 1);
+ grname = strdup(tptr);
continue;
}
break;