Skip to content

Commit

Permalink
Disable stdio buffering in test runner and replace signal(2) with sig…
Browse files Browse the repository at this point in the history
…action

First part is a workaround for issue #450
  • Loading branch information
ayrtonm committed Oct 22, 2024
1 parent 57d55ec commit 0550021
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions misc/test_runner/test_runner.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 0550021

Please sign in to comment.