summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-09 00:43:41 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-08-09 00:43:41 (GMT)
commit3cc635dabb0780914d51cdfad57912608196d099 (patch)
tree8be430ea009f9fa872daf0dda14ce31d3b94ca45 /Modules/faulthandler.c
parent652e758fc41c953c5235f389e7dbb481bc915f0a (diff)
downloadcpython-3cc635dabb0780914d51cdfad57912608196d099.zip
cpython-3cc635dabb0780914d51cdfad57912608196d099.tar.gz
cpython-3cc635dabb0780914d51cdfad57912608196d099.tar.bz2
faulthandler: fix the handler of user signals
Restore the errno before calling the previous signal handler, and not after.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index 469e490..4aa9124 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -659,17 +659,22 @@ faulthandler_user(int signum)
#ifdef HAVE_SIGACTION
if (user->chain) {
(void)sigaction(signum, &user->previous, NULL);
+ errno = save_errno;
+
/* call the previous signal handler */
raise(signum);
+
+ save_errno = errno;
(void)faulthandler_register(signum, user->chain, NULL);
+ errno = save_errno;
}
#else
if (user->chain) {
+ errno = save_errno;
/* call the previous signal handler */
user->previous(signum);
}
#endif
- errno = save_errno;
}
static int