diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2012-08-09 02:43:41 +0200 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2012-08-09 02:43:41 +0200 |
commit | 11d0095efdfb51e1d2e3b815eb9e0f12e8e6256a (patch) | |
tree | c593b8d3d3d5a5d3e9ab79195b540d2773b154c9 /Modules/faulthandler.c | |
parent | e39ef4f2b9d491c1304adf4bf35839e2b392cb89 (diff) | |
download | cpython-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.c | 7 |
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 |