source: vendor/glibc-tests/glibc/posix/tst-execvp1.c

Last change on this file was 2036, checked in by bird, 20 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 633 bytes
Line 
1#include <errno.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <unistd.h>
5
6static int
7do_test (void)
8{
9 char *cwd = get_current_dir_name ();
10 if (cwd == NULL)
11 {
12 puts ("get_current_dir_name failed");
13 return 1;
14 }
15
16 /* Make sure we do not find a binary with the name we are going to
17 use. */
18 setenv ("PATH", cwd, 1);
19
20 char *argv[] = { (char *) "does-not-exist", NULL };
21 errno = 0;
22 execvp (argv[0], argv);
23
24 if (errno != ENOENT)
25 {
26 printf ("errno = %d (%m), expected ENOENT\n", errno);
27 return 1;
28 }
29
30 return 0;
31}
32
33#define TEST_FUNCTION do_test ()
34#include "../test-skeleton.c"
Note: See TracBrowser for help on using the repository browser.