Back to index

glibc  2.9
Defines | Functions
tst-execlp1.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define TEST_FUNCTION   do_test ()


static int do_test (void)

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 33 of file tst-execlp1.c.

Function Documentation

static int do_test ( void  ) [static]

Definition at line 7 of file tst-execlp1.c.

  char *cwd = get_current_dir_name ();
  if (cwd == NULL)
      puts ("get_current_dir_name failed");
      return 1;

  /* Make sure we do not find a binary with the name we are going to
     use.  */
  setenv ("PATH", cwd, 1);

  static const char prog[] = "does-not-exist";
  errno = 0;
  execlp (prog, prog, NULL);

  if (errno != ENOENT)
      printf ("errno = %d (%m), expected ENOENT\n", errno);
      return 1;

  return 0;

Here is the call graph for this function: