Skip to content

Commit

Permalink
wasm2c: Uninstall sighandler in os_cleanup_signal_handler (#2043)
Browse files Browse the repository at this point in the history
  • Loading branch information
sbc100 authored Nov 7, 2022
1 parent 80ce9e1 commit 44370eb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions wasm2c/wasm-rt-impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,19 @@ static void os_install_signal_handler(void) {
}

static void os_cleanup_signal_handler(void) {
/* Undo what was done in os_install_signal_handler */
struct sigaction sa;
sa.sa_handler = SIG_DFL;
if (sigaction(SIGSEGV, &sa, NULL) != 0 || sigaction(SIGBUS, &sa, NULL)) {
perror("sigaction failed");
abort();
}

if (sigaltstack(NULL, NULL) != 0) {
perror("sigaltstack failed");
abort();
}

free(g_alt_stack);
}
#endif
Expand Down

0 comments on commit 44370eb

Please sign in to comment.