Skip to content

Commit

Permalink
gh-96652: Fix faulthandler chained signal without sigaction() (GH-96666)
Browse files Browse the repository at this point in the history
Fix the faulthandler implementation of faulthandler.register(signal,
chain=True) if the sigaction() function is not available: don't call
the previous signal handler if it's NULL.
(cherry picked from commit c580a81)

Co-authored-by: Victor Stinner <[email protected]>
  • Loading branch information
miss-islington and vstinner authored Sep 8, 2022
1 parent 6ee7a6b commit 3ae2be6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Fix the faulthandler implementation of ``faulthandler.register(signal,
chain=True)`` if the ``sigaction()`` function is not available: don't call
the previous signal handler if it's NULL. Patch by Victor Stinner.
2 changes: 1 addition & 1 deletion Modules/faulthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,7 @@ faulthandler_user(int signum)
errno = save_errno;
}
#else
if (user->chain) {
if (user->chain && user->previous != NULL) {
errno = save_errno;
/* call the previous signal handler */
user->previous(signum);
Expand Down

0 comments on commit 3ae2be6

Please sign in to comment.