From 227ad26723deb4e20cc695ed4f95f530f0175944 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Thu, 1 Aug 2024 07:56:27 +0100 Subject: [PATCH] * test/common/tests.c (W): Fix to use stdout(!). (parent_segv): Tweak output. --- test/common/tests.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/test/common/tests.c b/test/common/tests.c index ea7d8221..6a608748 100644 --- a/test/common/tests.c +++ b/test/common/tests.c @@ -110,7 +110,7 @@ void t_warning(const char *str, ...) NE_DBG_LOCKS | NE_DBG_XMLPARSE | NE_DBG_XML | NE_DBG_SSL | \ NE_DBG_HTTPPLAIN) -#define W(m) do { if (write(0, m, strlen(m)) < 0) _exit(99); } while(0) +#define W(m) do { if (write(STDOUT_FILENO, m, strlen(m)) < 0) _exit(99); } while(0) #define W_RED(m) do { if (use_colour) W("\033[41;37;01m"); \ W(m); if (use_colour) W("\033[00m\n"); } while (0); @@ -133,12 +133,16 @@ static void parent_segv(int signo) signal(SIGSEGV, SIG_DFL); signal(SIGABRT, SIG_DFL); if (signo == SIGSEGV) { - W_RED("FAILED - segmentation fault"); - } else if (signo == SIGABRT) { - W_RED("ABORTED"); + W_RED("FAILED - Segmentation fault--\n"); + } + else if (signo == SIGABRT) { + W_RED("ABORTED\n"); + } + else { + W_RED("-- Unexpected signal! --\n"); } reap_server(); - kill(getpid(), SIGSEGV); + kill(getpid(), signo); minisleep(); }