From 73193347133e750faf27f88fd3ab31ce43aff062 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 21 May 2024 06:59:33 +0200 Subject: Adding upstream version 1.47.1. Signed-off-by: Daniel Baumann --- lib/ext2fs/test_io.c | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) (limited to 'lib/ext2fs/test_io.c') 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 #endif -#ifdef HAVE_SYS_PRCTL_H -#include -#else -#define PR_GET_DUMPABLE 3 -#endif -#if (!defined(HAVE_PRCTL) && defined(linux)) -#include -#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) { -- cgit v1.2.3