Back to index

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

Go to the source code of this file.

Defines

#define TEST_FUNCTION   do_test ()

Functions

int foo (void)
static int do_test (void)

Variables

static const char testsubdir [] = "test-subdir"

Define Documentation

#define TEST_FUNCTION   do_test ()

Definition at line 71 of file tst-dlopenrpath.c.


Function Documentation

static int do_test ( void  ) [static]

Definition at line 34 of file tst-dlopenrpath.c.

{
  struct stat64 st;
  int result = 1;

  if (mkdir (testsubdir, 0777) != 0
      && (errno != EEXIST
         || stat64 (testsubdir, &st) != 0
         || !S_ISDIR (st.st_mode)))
    {
      printf ("cannot create directory %s\n", testsubdir);
      return 1;
    }

  if (system ("cp " PFX "firstobj.so " PFX "test-subdir/in-subdir.so") != 0)
    {
      puts ("cannot copy DSO");
      return 1;
    }

  void *p = dlopen ("in-subdir.so", RTLD_LAZY|RTLD_LOCAL);
  if (p != NULL)
    {
      puts ("succeeded in opening in-subdir.so from do_test");
      dlclose (p);
      goto out;
    }

  result = foo ();

 out:
  unlink (PFX "test-subdir/in-subdir.so");
  rmdir (testsubdir);

  return result;
}

Here is the call graph for this function:

int foo ( void  )

Variable Documentation

const char testsubdir[] = "test-subdir" [static]

Definition at line 30 of file tst-dlopenrpath.c.