nptl: Change tst-typesizes to _Static_assert
[glibc.git] / posix / tst-execvp4.c
blob589a56018fa14a9ea0558a7cfda1f79a5c4b627b
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 #ifndef EXECVP
9 # define EXECVP(file, argv) execvp (file, argv)
10 #endif
12 static int
13 do_test (void)
15 char buf[40] = "/usr/bin/does-not-exist";
16 size_t stemlen = strlen (buf);
17 struct stat64 st;
18 int cnt = 0;
19 while (stat64 (buf, &st) != -1 || errno != ENOENT
20 || stat64 (buf + 4, &st) != -1 || errno != ENOENT)
22 if (cnt++ == 100)
24 puts ("cannot find a unique file name");
25 return 0;
28 strcpy (buf + stemlen, ".XXXXXX");
29 mktemp (buf);
32 unsetenv ("PATH");
33 char *argv[] = { buf + 9, NULL };
34 EXECVP (argv[0], argv);
35 return 0;
38 #define TEST_FUNCTION do_test ()
39 #include "../test-skeleton.c"