summaryrefslogtreecommitdiff
path: root/libc/pwd_grp/sgetspent.c
diff options
context:
space:
mode:
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;
}