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 c580a81af9)

Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
Miss Islington (bot) 2022-09-08 03:43:24 -07:00 committed by GitHub
parent 6ee7a6b947
commit 3ae2be69cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -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.

View file

@ -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);