Support C11 __STDC_SOURCE__ and _ISOC11_SOURCE
[glibc.git] / posix / tst-execvp4.c
blob531fab227b6eca5ca5744d84bd1b9cf05430c0c9
1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
5 #include <unistd.h>
6 #include <sys/stat.h>
8 static int
9 do_test (void)
11 char buf[40] = "/usr/bin/does-not-exist";
12 size_t stemlen = strlen (buf);
13 struct stat64 st;
14 int cnt = 0;
15 while (stat64 (buf, &st) != -1 || errno != ENOENT
16 || stat64 (buf + 4, &st) != -1 || errno != ENOENT)
18 if (cnt++ == 100)
20 puts ("cannot find a unique file name");
21 return 0;
24 strcpy (buf + stemlen, ".XXXXXX");
25 mktemp (buf);
28 unsetenv ("PATH");
29 char *argv[] = { buf + 9, NULL };
30 execvp (argv[0], argv);
31 return 0;
34 #define TEST_FUNCTION do_test ()
35 #include "../test-skeleton.c"