]>
Commit | Line | Data |
---|---|---|
53e5696b UD |
1 | #include <errno.h> |
2 | #include <stdio.h> | |
3 | #include <stdlib.h> | |
4 | #include <unistd.h> | |
5 | ||
1eb89306 AZ |
6 | #ifndef EXECVP |
7 | # define EXECVP(file, argv) execvp (file, argv) | |
8 | #endif | |
9 | ||
53e5696b UD |
10 | static int |
11 | do_test (void) | |
12 | { | |
13 | char *cwd = get_current_dir_name (); | |
14 | if (cwd == NULL) | |
15 | { | |
16 | puts ("get_current_dir_name failed"); | |
17 | return 1; | |
18 | } | |
19 | ||
20 | /* Make sure we do not find a binary with the name we are going to | |
21 | use. */ | |
22 | setenv ("PATH", cwd, 1); | |
23 | ||
24 | char *argv[] = { (char *) "does-not-exist", NULL }; | |
25 | errno = 0; | |
1eb89306 | 26 | EXECVP (argv[0], argv); |
53e5696b UD |
27 | |
28 | if (errno != ENOENT) | |
29 | { | |
30 | printf ("errno = %d (%m), expected ENOENT\n", errno); | |
31 | return 1; | |
32 | } | |
33 | ||
34 | return 0; | |
35 | } | |
36 | ||
37 | #define TEST_FUNCTION do_test () | |
38 | #include "../test-skeleton.c" |