Back to index

glibc  2.9
Defines | Functions | Variables
tst-unlinkat.c File Reference
#include <dirent.h>
#include <fcntl.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(argc, argv)   prepare ()
#define TEST_FUNCTION   do_test ()


static void prepare (void)
static int do_test (void)


static int dir_fd

Define Documentation

#define PREPARE (   argc,
)    prepare ()

Definition at line 10 of file tst-unlinkat.c.

#define TEST_FUNCTION   do_test ()

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

Function Documentation

static int do_test ( void  ) [static]
static void prepare ( void  ) [static]

Definition at line 20 of file tst-unlinkat.c.

  size_t test_dir_len = strlen (test_dir);
  static const char dir_name[] = "/tst-unlinkat.XXXXXX";

  size_t dirbuflen = test_dir_len + sizeof (dir_name);
  char *dirbuf = malloc (dirbuflen);
  if (dirbuf == NULL)
      puts ("out of memory");
      exit (1);

  snprintf (dirbuf, dirbuflen, "%s%s", test_dir, dir_name);
  if (mkdtemp (dirbuf) == NULL)
      puts ("cannot create temporary directory");
      exit (1);

  add_temp_file (dirbuf);

  dir_fd = open (dirbuf, O_RDONLY | O_DIRECTORY);
  if (dir_fd == -1)
      puts ("cannot open directory");
      exit (1);

Here is the call graph for this function:

Variable Documentation

int dir_fd [static]

Definition at line 17 of file tst-unlinkat.c.