This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17922] New: [powerpc] getpwnam_r return value wrong for missing userid


https://sourceware.org/bugzilla/show_bug.cgi?id=17922

            Bug ID: 17922
           Summary: [powerpc] getpwnam_r return value wrong for missing
                    userid
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: seurer at linux dot vnet.ibm.com
                CC: drepper.fsp at gmail dot com

#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 are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]