X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fpasswd%2Fgetspnam.c;h=709b526dc503abb5ea8ab3cc5ec405196a6d7c1a;hb=711673ee772e20a74aaf301c2d7745c20c4f4d47;hp=041f896525f1e68f6fbf8076a3bb42a154f0752b;hpb=0b44a0315b47dd8eced9f3b7f31580cf14bbfc01;p=musl 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; }