summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-04 08:29:14 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-06-04 08:29:14 +0000
commit6df8e363ea10bab00e21db2c40f213fbdb3fc55e (patch)
tree968b1beae95a6a8a548056726bf39bcd965656e7
parentfc9d0bd3d7bede9e761c8da01efc5d87d4d038f7 (diff)
in case a handling a +groupname:*:: entry fails due to lack of memory,
do not just skip the entry, but report the error condition; ok millert@
-rw-r--r--lib/libc/gen/getgrent.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c
index 9a332a987a8..de250c73ab0 100644
--- a/lib/libc/gen/getgrent.c
+++ b/lib/libc/gen/getgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getgrent.c,v 1.27 2009/06/03 16:02:44 schwarze Exp $ */
+/* $OpenBSD: getgrent.c,v 1.28 2009/06/04 08:29:13 schwarze Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -431,7 +431,8 @@ grscan(int search, gid_t gid, const char *name, struct group *p_gr,
__ypexclude_is(&__ypexhead, tptr))
continue;
__ypmode = YPMODE_NAME;
- grname = strdup(tptr);
+ if ((grname = strdup(tptr)) == NULL)
+ return (0);
continue;
}
break;