summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/fgetpwent.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-06-27 10:19:29 +0000
committerEric Andersen <andersen@codepoet.org>2003-06-27 10:19:29 +0000
commit2e55dec21f3310e6868689fc1f4c4074ea3a35bb (patch)
tree77479d130301a86ca26009cf712dc0ebe3ddd340 /libc/pwd_grp/fgetpwent.c
parentea3abe244d9ad2ec59d00b29152fc457571d2d37 (diff)
Fixup errno handling
-Erik
Diffstat (limited to 'libc/pwd_grp/fgetpwent.c')
-rw-r--r--libc/pwd_grp/fgetpwent.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libc/pwd_grp/fgetpwent.c b/libc/pwd_grp/fgetpwent.c
index 5ca08d3b0..8917c29d0 100644
--- a/libc/pwd_grp/fgetpwent.c
+++ b/libc/pwd_grp/fgetpwent.c
@@ -37,22 +37,23 @@ int fgetpwent_r (FILE *file, struct passwd *password,
char *buff, size_t buflen, struct passwd **crap)
{
if (file == NULL) {
- __set_errno(EINTR);
- return -1;
+ return EINTR;
}
return(__getpwent_r(password, buff, buflen, fileno(file)));
}
struct passwd *fgetpwent(FILE * file)
{
+ int ret;
static char line_buff[PWD_BUFFER_SIZE];
static struct passwd pwd;
LOCK;
- if (fgetpwent_r(file, &pwd, line_buff, sizeof(line_buff), NULL) != -1) {
+ if ((ret=fgetpwent_r(file, &pwd, line_buff, sizeof(line_buff), NULL)) == 0) {
UNLOCK;
return &pwd;
}
UNLOCK;
+ __set_errno(ret);
return NULL;
}