From: Kamil Becmer Date: Sat, 15 Feb 2020 16:17:52 +0000 (+0100) Subject: Don't assign stderr on non-glibc X-Git-Tag: v1.7~27^2 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=9eeed7d0012ba7a19a2d6f7f6b3f9c7c83ed86f3;p=sx%2Fsimavr.git Don't assign stderr on non-glibc Signed-off-by: Kamil Becmer --- diff --git a/tests/tests.c b/tests/tests.c index 579b562..8161eba 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -16,10 +16,7 @@ int tests_disable_stdout = 1; static char *test_name = "(uninitialized test)"; static int finished = 0; -#ifdef __MINGW32__ -#define restore_stderr() {} -#define map_stderr() {} -#else +#if defined(__GLIBC__) && !defined(__MINGW32__) static FILE *orig_stderr = NULL; #define restore_stderr() { if (orig_stderr) stderr = orig_stderr; } #define map_stderr() { if (tests_disable_stdout) { \ @@ -27,6 +24,9 @@ static FILE *orig_stderr = NULL; fclose(stdout); \ stderr = stdout; \ } } +#else +#define restore_stderr() {} +#define map_stderr() {} #endif static void atexit_handler(void) {