1 // Regression test for a crash in getpwnam_r and similar interceptors. 2 // RUN: %clangxx -O0 -g %s -o %t && %run %t 3 4 #include <assert.h> 5 #include <errno.h> 6 #include <pwd.h> 7 #include <signal.h> 8 #include <stdio.h> 9 #include <sys/types.h> 10 #include <unistd.h> 11 main(void)12int main(void) { 13 struct passwd pwd; 14 struct passwd *pwdres; 15 char buf[10000]; 16 int res = getpwnam_r("no-such-user", &pwd, buf, sizeof(buf), &pwdres); 17 assert(res == 0 || res == ENOENT); 18 assert(pwdres == 0); 19 return 0; 20 } 21