summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/sgetspent.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/sgetspent.c
parentea3abe244d9ad2ec59d00b29152fc457571d2d37 (diff)
Fixup errno handling
-Erik
Diffstat (limited to 'libc/pwd_grp/sgetspent.c')
-rw-r--r--libc/pwd_grp/sgetspent.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/pwd_grp/sgetspent.c b/libc/pwd_grp/sgetspent.c
index 1925a78ec..5f018b9f1 100644
--- a/libc/pwd_grp/sgetspent.c
+++ b/libc/pwd_grp/sgetspent.c
@@ -40,14 +40,16 @@ int sgetspent_r (const char *string, struct spwd *spwd,
struct spwd *sgetspent(const char *string)
{
+ int ret;
static char line_buff[PWD_BUFFER_SIZE];
static struct spwd spwd;
LOCK;
- if (sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), NULL) != -1) {
+ if ((ret = sgetspent_r(string, &spwd, line_buff, sizeof(line_buff), NULL)) == 0) {
UNLOCK;
return &spwd;
}
+ __set_errno(ret);
UNLOCK;
return NULL;
}