11 static void prepare (int argc, char *argv[]);
12 static int do_test (void);
13 #define PREPARE(argc, argv) prepare (argc, argv)
14 #define TEST_FUNCTION do_test ()
15 #include "../test-skeleton.c"
18 # define EXECVP(file, argv) execvp (file, argv)
24 prepare (int argc, char *argv[])
29 buf = xasprintf ("cp %s %n%s-copy", argv[0], &off, argv[0]);
30 if (system (buf) != 0)
32 puts ("system failed");
36 /* Make it not executable. */
38 if (chmod (copy, 0666) != 0)
40 puts ("chmod failed");
51 /* Make sure we do not find a binary with the name we are going to
53 char *bindir = strdupa (copy);
54 bindir = canonicalize_file_name (dirname (bindir));
57 puts ("canonicalize_file_name failed");
61 char *path = xasprintf ("%s:../libio:../elf", bindir);
63 setenv ("PATH", path, 1);
65 char *argv[] = { basename (copy), NULL };
67 EXECVP (argv[0], argv);
71 printf ("errno = %d (%m), expected EACCES\n", errno);