summaryrefslogtreecommitdiff
path: root/lib/libc/gen/_sys_nerr.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2009-12-19 22:41:40 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2009-12-19 22:41:40 +0000
commit5b2b598d3bd2c4374a944b8b2c66147ec7bdf9a0 (patch)
treed9aaeb952fb48e92726a3e788870cb85e1eb12e1 /lib/libc/gen/_sys_nerr.c
parent1fe64736e6d768c64774010591775e1b292863f2 (diff)
Implement proper error handling for getgrent(3), getgrnam(3) and getgrgid(3).
1) Distinguish normal end of data (like eof, YPERR_NOMORE, YPERR_KEY) from error conditions. 2) Save errno(2) and restore it in case of success, as suggested by deraadt@ and beck@. While this code is touched, * move the common code for the yp_first and yp_next calls after the respective if/else-block; note that free(data) is not needed in case of failure and that __ypcurrent = NULL does no harm after failing yp_first. * return 0, not NULL: the return value of grscan is int, not a pointer. This is the last part of the work done on getgrent.c during c2k9, heavily relying on the other improvements done at that time. This has been rotting in my tree far too long. "get it in" deraadt@; also lightly tested by simon@ some time ago
Diffstat (limited to 'lib/libc/gen/_sys_nerr.c')
0 files changed, 0 insertions, 0 deletions