Ignore handling SIG_DFL/SIG_IGN for previous sig action (#2589)

This commit is contained in:
Wenyong Huang 2023-09-26 19:59:48 +08:00 committed by GitHub
parent ade73f6142
commit a50a438461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -543,14 +543,12 @@ signal_callback(int sig_num, siginfo_t *sig_info, void *sig_ucontext)
if (prev_sig_act && (prev_sig_act->sa_flags & SA_SIGINFO)) { if (prev_sig_act && (prev_sig_act->sa_flags & SA_SIGINFO)) {
prev_sig_act->sa_sigaction(sig_num, sig_info, sig_ucontext); prev_sig_act->sa_sigaction(sig_num, sig_info, sig_ucontext);
} }
else if (prev_sig_act && (void *)prev_sig_act->sa_handler == SIG_DFL) { else if (prev_sig_act
/* Default action */ && prev_sig_act->sa_handler
sigaction(sig_num, prev_sig_act, NULL); /* Filter out SIG_DFL and SIG_IGN here, they will
} run into the else branch below */
else if (prev_sig_act && (void *)prev_sig_act->sa_handler == SIG_IGN) { && (void *)prev_sig_act->sa_handler != SIG_DFL
/* Ignore this signal */ && (void *)prev_sig_act->sa_handler != SIG_IGN) {
}
else if (prev_sig_act && prev_sig_act->sa_handler) {
prev_sig_act->sa_handler(sig_num); prev_sig_act->sa_handler(sig_num);
} }
/* Output signal info and then crash if signal is unhandled */ /* Output signal info and then crash if signal is unhandled */