[C++20] [Modules] Fix may-be incorrect ADL for module local entities (#123931)
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Linux / getpwnam_r_invalid_user.cpp
blobc0d6cfea1fbef783b6e1a46f748e53c7d2150a19
1 // Regression test for a crash in getpwnam_r and similar interceptors.
2 // RUN: %clangxx -O0 -g %s -o %t && %run %t
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>
12 int 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;