summaryrefslogtreecommitdiff
path: root/src/passwd/getspnam.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/passwd/getspnam.c')
-rw-r--r--src/passwd/getspnam.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/passwd/getspnam.c b/src/passwd/getspnam.c
index 041f8965..709b526d 100644
--- a/src/passwd/getspnam.c
+++ b/src/passwd/getspnam.c
@@ -8,10 +8,11 @@ struct spwd *getspnam(const char *name)
static char *line;
struct spwd *res;
int e;
+ int orig_errno = errno;
if (!line) line = malloc(LINE_LIM);
if (!line) return 0;
e = getspnam_r(name, &sp, line, LINE_LIM, &res);
- if (e) errno = e;
+ errno = e ? e : orig_errno;
return res;
}