Back to index

glibc  2.9
Defines | Functions | Variables
tst-execlp2.c File Reference
#include <errno.h>
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define PREPARE(argc, argv)   prepare (argc, argv)
#define TEST_FUNCTION   do_test ()


static void prepare (int argc, char *argv[])
static int do_test (void)


static char * copy

Define Documentation

#define PREPARE (   argc,
)    prepare (argc, argv)

Definition at line 13 of file tst-execlp2.c.

#define TEST_FUNCTION   do_test ()

Definition at line 14 of file tst-execlp2.c.

Function Documentation

static int do_test ( void  ) [static]
static void prepare ( int  argc,
char *  argv[] 
) [static]

Definition at line 21 of file tst-execlp2.c.

  char *buf;
  int off;
  asprintf (&buf, "cp %s %n%s-copy", argv[0], &off, argv[0]);
  if (buf == NULL)
      puts ("asprintf  failed");
      exit (1);
  if (system (buf) != 0)
      puts ("system  failed");
      exit (1);

  /* Make it not executable.  */
  copy = buf + off;
  if (chmod (copy, 0666) != 0)
      puts ("chmod  failed");
      exit (1);

  add_temp_file (copy);

Here is the call graph for this function:

Variable Documentation

char* copy [static]

Definition at line 18 of file tst-execlp2.c.