Back to index

glibc  2.9
Defines | Functions | Variables
tst-fstatat.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.

Defines

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

Functions

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

Variables

static int dir_fd

Define Documentation

#define PREPARE (   argc,
  argv 
)    prepare ()

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

#define TEST_FUNCTION   do_test ()

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


Function Documentation

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

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

{
  size_t test_dir_len = strlen (test_dir);
  static const char dir_name[] = "/tst-fstatat.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-fstatat.c.