Description of problem: getpwuid_r() on RH-9 can return zero, indicating success, when in fact there was an error. Version-Release number of selected component (if applicable): stock RH-9, glibc-2.3.2-11.9 How reproducible: always Steps to Reproduce: 1. Compile and run this program, make sure limit on file descriptors is less than 1024 (so getpwuid_r should fail with EMFILE): #include <stdio.h> #include <pwd.h> #include <unistd.h> #include <sys/types.h> #include <errno.h> #include <string.h> int main(void) { FILE *fd[1024]; int i; for(i = 0; i < 1024; i++) { char buf[256]; sprintf(buf, "/tmp/f%d", i); fd[i] = fopen(buf, "w"); } int uid = geteuid(); struct passwd pwent; struct passwd* p; char pwbuf[1024]; errno = 0; int result = getpwuid_r(uid, &pwent, pwbuf, sizeof(pwbuf), &p); if (result == 0 && p == NULL) printf("getpwuid_r returns %d, but p is %p and errno = %d\n", result, p, errno); if (result != 0) { printf("getpwuid_r: %s\n", strerror(result)); } return 0; } Actual results: on RH-9: fez:~> g++ tstgetpwuid_r.cpp fez:~> ./a.out getpwuid_r returns 0, but p is (nil) and errno = 24 Expected results: getpwuid_r should return non-zero value to indicate failure, for example, on RH-7.3: screen:~> ./a.out getpwuid_r: Too many open files Additional info:
With the current glibc the expected result is seen. Closing the bug now.