diff options
author | Christian Perrier <bubulle@debian.org> | 2013-07-27 18:38:24 +0200 |
---|---|---|
committer | Christian Perrier <bubulle@debian.org> | 2013-07-27 18:38:24 +0200 |
commit | 5e7263d5769fdec5cdc9fd8a9e73611c14714edd (patch) | |
tree | 113e8de082a356ec4bf1b4f1fb1518a5155d9874 /tests/common/fopen_failure.c | |
parent | 03e6eeb8bb4697fa0e488fabcf507f907f244925 (diff) | |
download | shadow-debian.tar.gz |
Drop tests/ from the debian branchdebian
Diffstat (limited to 'tests/common/fopen_failure.c')
-rw-r--r-- | tests/common/fopen_failure.c | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/tests/common/fopen_failure.c b/tests/common/fopen_failure.c deleted file mode 100644 index 750cd667..00000000 --- a/tests/common/fopen_failure.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * gcc fopen_failure.c -o fopen_failure.so -shared -ldl - * LD_PRELOAD=./fopen_failure.so FAILURE_PATH=/etc/shadow ./test /etc/shadow - */ - -#define _GNU_SOURCE -#include <dlfcn.h> -#include <errno.h> -#include <assert.h> - -#include <stdio.h> -#include <stdlib.h> - - -typedef FILE * (*fopen_type) (const char *path, const char *mode); -static fopen_type next_fopen; - -static const char *failure_path = NULL; - -FILE *fopen64 (const char *path, const char *mode) -{ -printf ("fopen64(%s, %s)\n", path, mode); - if (NULL == next_fopen) - { - next_fopen = dlsym (RTLD_NEXT, "fopen64"); - assert (NULL != next_fopen); - } - if (NULL == failure_path) { - failure_path = getenv ("FAILURE_PATH"); - if (NULL == failure_path) { - fputs ("No FAILURE_PATH defined\n", stderr); - } - } - - if ( (NULL != path) - && (NULL != failure_path) - && (strcmp (path, failure_path) == 0)) - { - fprintf (stderr, "fopen64 FAILURE %s %s ...\n", path, mode); - errno = EIO; - return NULL; - } - - return next_fopen (path, mode); -} - |