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/time_past.c | |
parent | 03e6eeb8bb4697fa0e488fabcf507f907f244925 (diff) | |
download | shadow-debian.tar.gz |
Drop tests/ from the debian branchdebian
Diffstat (limited to 'tests/common/time_past.c')
-rw-r--r-- | tests/common/time_past.c | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/common/time_past.c b/tests/common/time_past.c deleted file mode 100644 index d0eb741e..00000000 --- a/tests/common/time_past.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * gcc time_past.c -o time_past.so -shared -ldl - * LD_PRELOAD=./time_past.so PAST_DAYS=2 ./test - */ - -#define _GNU_SOURCE -#include <dlfcn.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <stdarg.h> -#include <fcntl.h> -#include <string.h> -#include <errno.h> -#include <assert.h> - -#include <stdio.h> -#include <stdlib.h> - - -typedef time_t (*time_type) (time_t *t); -static time_type next_time; - -static int time_past = 0; -static char *past = NULL; - -time_t time (time_t *t) -{ - time_t res; - - if (NULL == next_time) - { - next_time = dlsym (RTLD_NEXT, "time"); - assert (NULL != next_time); - } - if (NULL == past) { - const char *past = getenv ("PAST_DAYS"); - if (NULL == past) { - fputs ("No PAST_DAYS defined\n", stderr); - } - time_past = atoi (past); - } - - res = next_time (t); - res -= 24*60*60*time_past; - - if (NULL != t) { - *t = res; - } - - return res; -} - |