1 #include <errno.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <unistd.h>
5 
6 #ifndef EXECVP
7 # define EXECVP(file, argv) execvp (file, argv)
8 #endif
9 
10 static int
do_test(void)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;
26   EXECVP (argv[0], argv);
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"
39