[ORC] Fail materialization in tasks that are destroyed before running.
[llvm-project.git] / compiler-rt / test / sanitizer_common / TestCases / Linux / getgrouplist.cpp
blob7e1b8f1963f27c3747587f2d0ea43c5a9c29fe8b
1 // RUN: %clangxx -O0 -g %s -o %t && %run %t
3 #include <stdlib.h>
4 #include <unistd.h>
5 #include <grp.h>
7 int main(void) {
8 gid_t *groups;
9 group *root;
10 int ngroups;
12 ngroups = sysconf(_SC_NGROUPS_MAX);
13 groups = (gid_t *)malloc(ngroups * sizeof(gid_t));
14 if (!groups)
15 exit(1);
17 if (!(root = getgrnam("root")))
18 exit(2);
20 if (getgrouplist("root", root->gr_gid, groups, &ngroups) == -1)
21 exit(3);
23 if (groups && ngroups) {
24 free(groups);
25 exit(0);
28 return -1;