#include <pwd.h> #include <stdio.h> #include <sys/types.h> #include <unistd.h> int main(void) { struct passwd pwd; struct passwd *pwdres; char buf[10000]; int res = getpwnam_r("no-such-user", &pwd, buf, sizeof(buf), &pwdres); printf("res: %d\n", res); printf("(pwdres == 0): %d\n", (int)(pwdres == 0)); return 0; } According to the getpwnam_r documentation On success, getpwnam_r() and getpwuid_r() return zero, and set *result to pwd. If no matching password record was found, these functions return 0 and store NULL in *result. In case of error, an error number is returned, and NULL is stored in *result. this program should print res: 0 (pwdres == 0): 1 but on some power systems "res" is non-zero (specifically 2). I tried it on several power systems and on some it worked properly and others not (both BE and LE). I also tried it on an x86 system and it worked properly there. It failed on systems with version 2.17 and 2.20 but worked on ones with 2.15 and 2.19 so I am not sure what releases are really affected.
You should verify that the affected systems are properly set up.
Getting straces from a failure would be interesting. 2 is likely ENOENT. Where does it come from?
Could not recreate it on power systems with glibc version 2.17(BE/LE) and version 2.20 (BE)
Could not recreate.