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 <pwd.h> 6#include <signal.h> 7#include <stdio.h> 8#include <sys/types.h> 9#include <unistd.h> 10 11int main(void) { 12 struct passwd pwd; 13 struct passwd *pwdres; 14 char buf[10000]; 15 int res = getpwnam_r("no-such-user", &pwd, buf, sizeof(buf), &pwdres); 16 assert(res == 0); 17 assert(pwdres == 0); 18 return 0; 19} 20