diff options
author | Rich Felker <dalias@aerifal.cx> | 2017-06-15 13:01:34 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2017-06-15 13:01:34 -0400 |
commit | 2d7d05f031e014068a61d3076c6178513395d2ae (patch) | |
tree | 533f4bd2fedea2ff59d998ebc1f6c73aabc1ac44 /src/passwd/getgr_r.c | |
parent | 5c10c33d2a35204ee76931625a007fcc8cca3228 (diff) | |
download | musl-2d7d05f031e014068a61d3076c6178513395d2ae.tar.gz musl-2d7d05f031e014068a61d3076c6178513395d2ae.tar.xz musl-2d7d05f031e014068a61d3076c6178513395d2ae.zip |
set errno when getpw*_r, getgr*_r, and getspnam_r fail
these functions return an error code, and are not explicitly documented to set errno, but they are nonstandard and the historical implementations do set errno as well, and some applications expect this behavior. do likewise for compatibility. patch by Rudolph Pereira.
Diffstat (limited to 'src/passwd/getgr_r.c')
-rw-r--r-- | src/passwd/getgr_r.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/passwd/getgr_r.c b/src/passwd/getgr_r.c index 7246e8a4..f3e8f603 100644 --- a/src/passwd/getgr_r.c +++ b/src/passwd/getgr_r.c @@ -34,6 +34,7 @@ static int getgr_r(const char *name, gid_t gid, struct group *gr, char *buf, siz free(mem); free(line); pthread_setcancelstate(cs, 0); + if (rv) errno = rv; return rv; } |