diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-06-27 10:19:29 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-06-27 10:19:29 +0000 |
commit | 2e55dec21f3310e6868689fc1f4c4074ea3a35bb (patch) | |
tree | 77479d130301a86ca26009cf712dc0ebe3ddd340 /libc/pwd_grp/spent.c | |
parent | ea3abe244d9ad2ec59d00b29152fc457571d2d37 (diff) |
Fixup errno handling
-Erik
Diffstat (limited to 'libc/pwd_grp/spent.c')
-rw-r--r-- | libc/pwd_grp/spent.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libc/pwd_grp/spent.c b/libc/pwd_grp/spent.c index d1b8ca07c..b281072f4 100644 --- a/libc/pwd_grp/spent.c +++ b/libc/pwd_grp/spent.c @@ -64,26 +64,29 @@ void endspent(void) int getspent_r (struct spwd *spwd, char *buff, size_t buflen, struct spwd **crap) { + int ret; LOCK; - if (spwd_fd != -1 && __getspent_r(spwd, buff, buflen, spwd_fd) != -1) { + if (spwd_fd != -1 && (ret=__getspent_r(spwd, buff, buflen, spwd_fd)) == 0) { UNLOCK; return 0; } UNLOCK; - return -1; + return ret; } struct spwd *getspent(void) { + int ret; static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; LOCK; - if (getspent_r(&spwd, line_buff, sizeof(line_buff), NULL) != -1) { + if ((ret=getspent_r(&spwd, line_buff, sizeof(line_buff), NULL)) == 0) { UNLOCK; return &spwd; } UNLOCK; + __set_errno(ret); return NULL; } |