From 2d7d05f031e014068a61d3076c6178513395d2ae Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Thu, 15 Jun 2017 13:01:34 -0400 Subject: 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. --- src/passwd/getgr_r.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/passwd/getgr_r.c') 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; } -- cgit v1.2.1