summaryrefslogtreecommitdiffstats
path: root/lib/ext2fs/test_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext2fs/test_io.c')
-rw-r--r--lib/ext2fs/test_io.c43
1 files changed, 5 insertions, 38 deletions
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index 6843edb..0324e53 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -23,14 +23,6 @@
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef HAVE_SYS_PRCTL_H
-#include <sys/prctl.h>
-#else
-#define PR_GET_DUMPABLE 3
-#endif
-#if (!defined(HAVE_PRCTL) && defined(linux))
-#include <sys/syscall.h>
-#endif
#include "ext2_fs.h"
#include "ext2fs.h"
@@ -144,31 +136,6 @@ static void test_abort(io_channel channel, unsigned long block)
abort();
}
-static char *safe_getenv(const char *arg)
-{
-#if !defined(_WIN32)
- if ((getuid() != geteuid()) || (getgid() != getegid()))
- return NULL;
-#endif
-#if HAVE_PRCTL
- if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
- return NULL;
-#else
-#if (defined(linux) && defined(SYS_prctl))
- if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0)
- return NULL;
-#endif
-#endif
-
-#if defined(HAVE_SECURE_GETENV)
- return secure_getenv(arg);
-#elif defined(HAVE___SECURE_GETENV)
- return __secure_getenv(arg);
-#else
- return getenv(arg);
-#endif
-}
-
static errcode_t test_open(const char *name, int flags, io_channel *channel)
{
io_channel io = NULL;
@@ -217,25 +184,25 @@ static errcode_t test_open(const char *name, int flags, io_channel *channel)
data->write_blk64 = test_io_cb_write_blk64;
data->outfile = NULL;
- if ((value = safe_getenv("TEST_IO_LOGFILE")) != NULL)
+ if ((value = ext2fs_safe_getenv("TEST_IO_LOGFILE")) != NULL)
data->outfile = fopen(value, "w");
if (!data->outfile)
data->outfile = stderr;
data->flags = 0;
- if ((value = safe_getenv("TEST_IO_FLAGS")) != NULL)
+ if ((value = ext2fs_safe_getenv("TEST_IO_FLAGS")) != NULL)
data->flags = strtoul(value, NULL, 0);
data->block = 0;
- if ((value = safe_getenv("TEST_IO_BLOCK")) != NULL)
+ if ((value = ext2fs_safe_getenv("TEST_IO_BLOCK")) != NULL)
data->block = strtoul(value, NULL, 0);
data->read_abort_count = 0;
- if ((value = safe_getenv("TEST_IO_READ_ABORT")) != NULL)
+ if ((value = ext2fs_safe_getenv("TEST_IO_READ_ABORT")) != NULL)
data->read_abort_count = strtoul(value, NULL, 0);
data->write_abort_count = 0;
- if ((value = safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
+ if ((value = ext2fs_safe_getenv("TEST_IO_WRITE_ABORT")) != NULL)
data->write_abort_count = strtoul(value, NULL, 0);
if (data->real) {