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/fgetspent.c | |
parent | ea3abe244d9ad2ec59d00b29152fc457571d2d37 (diff) |
Fixup errno handling
-Erik
Diffstat (limited to 'libc/pwd_grp/fgetspent.c')
-rw-r--r-- | libc/pwd_grp/fgetspent.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/pwd_grp/fgetspent.c b/libc/pwd_grp/fgetspent.c index 20698da1b..79594ecea 100644 --- a/libc/pwd_grp/fgetspent.c +++ b/libc/pwd_grp/fgetspent.c @@ -36,22 +36,23 @@ int fgetspent_r (FILE *file, struct spwd *spwd, char *buff, size_t buflen, struct spwd **crap) { if (file == NULL) { - __set_errno(EINTR); - return -1; + return EINTR; } return(__getspent_r(spwd, buff, buflen, fileno(file))); } struct spwd *fgetspent(FILE * file) { + int ret; static char line_buff[PWD_BUFFER_SIZE]; static struct spwd spwd; LOCK; - if (fgetspent_r(file, &spwd, line_buff, sizeof(line_buff), NULL) != -1) { + if ((ret=fgetspent_r(file, &spwd, line_buff, sizeof(line_buff), NULL)) == 0) { UNLOCK; return &spwd; } UNLOCK; + __set_errno(ret); return NULL; } |