Back to index

glibc  2.9
Defines | Functions | Variables
bug-glob1.c File Reference
#include <errno.h>
#include <error.h>
#include <glob.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "../test-skeleton.c"

Go to the source code of this file.


#define PREPARE   prepare
#define TEST_FUNCTION   do_test ()


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


static char * fname

Define Documentation

#define PREPARE   prepare

Definition at line 12 of file bug-glob1.c.

#define TEST_FUNCTION   do_test ()

Definition at line 14 of file bug-glob1.c.

Function Documentation

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

Definition at line 22 of file bug-glob1.c.

  if (argc < 2)
    error (EXIT_FAILURE, 0, "missing argument");

  size_t len = strlen (argv[1]);
  static const char ext[] = "globXXXXXX";
  fname = malloc (len + sizeof (ext));
  if (fname == NULL)
    error (EXIT_FAILURE, errno, "cannot create temp file");
  strcpy (stpcpy (fname, argv[1]), ext);
  fname = mktemp (fname);
  if (fname == NULL || *fname == '\0')
    error (EXIT_FAILURE, errno, "cannot create temp file name");
  if (symlink ("bug-glob1-does-not-exist", fname) != 0)
      if (errno == EEXIST)
       goto again;

      error (EXIT_FAILURE, errno, "cannot create symlink");
  add_temp_file (fname);

Here is the call graph for this function:

Variable Documentation

char* fname [static]

Definition at line 19 of file bug-glob1.c.