Properly initialize sigaction struct

The code in handle_signal() wasn't clearing the struct sigaction before passing it to sigaction().
This meant that we would block a random set of signals while executing the default handler, or jump to the uninitialized __sa_sigaction__ (instead of sa_handler).
Initialize properly as we do in setup_signal_handler().
This commit is contained in:
hwangcc23 2017-08-31 22:48:33 +08:00
parent 4dca8e6e0b
commit 92b8196192
1 changed files with 2 additions and 0 deletions

View File

@ -305,6 +305,8 @@ void handle_signal(int sig, siginfo_t *info, void *data) {
struct sigaction action; struct sigaction action;
action.sa_handler = SIG_DFL; action.sa_handler = SIG_DFL;
action.sa_flags = 0;
sigemptyset(&action.sa_mask);
sigaction(sig, &action, NULL); sigaction(sig, &action, NULL);
raised_signal = sig; raised_signal = sig;