From 05500219073036185518a872e1a74b86c8ea762b Mon Sep 17 00:00:00 2001 From: Ayrton Munoz Date: Thu, 17 Oct 2024 13:35:47 -0400 Subject: [PATCH] Disable stdio buffering in test runner and replace signal(2) with sigaction First part is a workaround for issue #450 --- misc/test_runner/test_runner.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/misc/test_runner/test_runner.c b/misc/test_runner/test_runner.c index ed568fd6a..019582582 100644 --- a/misc/test_runner/test_runner.c +++ b/misc/test_runner/test_runner.c @@ -106,9 +106,10 @@ void print_mpk_message(int sig) { _exit(0); } -// Installs the previously defined signal handler and disables buffering on -// stdout to allow using printf prior to the sighandler +// Installs the previously defined signal handler __attribute__((constructor)) void install_segfault_handler(void) { - setbuf(stdout, NULL); - signal(SIGSEGV, handle_segfault); + struct sigaction act = { + .sa_handler = handle_segfault, + }; + sigaction(SIGSEGV, &act, NULL); }