[BZ #1978]
[glibc.git] / posix / tst-execvp3.c
blob5ebc87952d6d627fefa59ae23adf3b7d17ec9159
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <unistd.h>
5 #include <sys/stat.h>
8 static void do_prepare (void);
9 #define PREPARE(argc, argv) do_prepare ()
10 static int do_test (void);
11 #define TEST_FUNCTION do_test ()
13 #include "../test-skeleton.c"
16 static char *fname;
18 static void
19 do_prepare (void)
21 int fd = create_temp_file ("testscript", &fname);
22 dprintf (fd, "echo foo\n");
23 fchmod (fd, 0700);
24 close (fd);
28 static int
29 do_test (void)
31 if (setenv ("PATH", test_dir, 1) != 0)
33 puts ("setenv failed");
34 return 1;
37 char *argv[] = { fname, NULL };
38 execvp (basename (fname), argv);
40 /* If we come here, the execvp call failed. */
41 return 1;