Skip to content

Commit 3d6e6be

Browse files
gh-96652: Fix faulthandler chained signal without sigaction() (GH-96666)
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]>
1 parent a3d5ecb commit 3d6e6be

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fix the faulthandler implementation of ``faulthandler.register(signal,
2+
chain=True)`` if the ``sigaction()`` function is not available: don't call
3+
the previous signal handler if it's NULL. Patch by Victor Stinner.

Modules/faulthandler.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ faulthandler_user(int signum)
862862
errno = save_errno;
863863
}
864864
#else
865-
if (user->chain) {
865+
if (user->chain && user->previous != NULL) {
866866
errno = save_errno;
867867
/* call the previous signal handler */
868868
user->previous(signum);

0 commit comments

Comments
 (0)