Skip to content

Commit

Permalink
* test/common/tests.c (W): Fix to use stdout(!).
Browse files Browse the repository at this point in the history
  (parent_segv): Tweak output.
  • Loading branch information
notroj committed Sep 4, 2024
1 parent c383f3e commit 227ad26
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions test/common/tests.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
}

Expand Down

0 comments on commit 227ad26

Please sign in to comment.