summaryrefslogtreecommitdiff
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-08-09 02:43:41 +0200
committerVictor Stinner <victor.stinner@gmail.com>2012-08-09 02:43:41 +0200
commit11d0095efdfb51e1d2e3b815eb9e0f12e8e6256a (patch)
treec593b8d3d3d5a5d3e9ab79195b540d2773b154c9 /Modules/faulthandler.c
parente39ef4f2b9d491c1304adf4bf35839e2b392cb89 (diff)
downloadcpython-11d0095efdfb51e1d2e3b815eb9e0f12e8e6256a.tar.gz
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 469e490268..4aa9124263 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