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/getpw_r.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/passwd/getpw_r.c') diff --git a/src/passwd/getpw_r.c b/src/passwd/getpw_r.c index e8cc811e..0c87ab05 100644 --- a/src/passwd/getpw_r.c +++ b/src/passwd/getpw_r.c @@ -27,6 +27,7 @@ static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, si } free(line); pthread_setcancelstate(cs, 0); + if (rv) errno = rv; return rv; } -- cgit v1.2.1