Kaydet (Commit) 3cc635da authored tarafından Victor Stinner's avatar Victor Stinner

faulthandler: fix the handler of user signals

Restore the errno before calling the previous signal handler, and not after.
üst 652e758f
...@@ -659,17 +659,22 @@ faulthandler_user(int signum) ...@@ -659,17 +659,22 @@ faulthandler_user(int signum)
#ifdef HAVE_SIGACTION #ifdef HAVE_SIGACTION
if (user->chain) { if (user->chain) {
(void)sigaction(signum, &user->previous, NULL); (void)sigaction(signum, &user->previous, NULL);
errno = save_errno;
/* call the previous signal handler */ /* call the previous signal handler */
raise(signum); raise(signum);
save_errno = errno;
(void)faulthandler_register(signum, user->chain, NULL); (void)faulthandler_register(signum, user->chain, NULL);
errno = save_errno;
} }
#else #else
if (user->chain) { if (user->chain) {
errno = save_errno;
/* call the previous signal handler */ /* call the previous signal handler */
user->previous(signum); user->previous(signum);
} }
#endif #endif
errno = save_errno;
} }
static int static int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment