mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
faulthandler: fix the handler of user signals
Restore the errno before calling the previous signal handler, and not after.
This commit is contained in:
parent
652e758fc4
commit
3cc635dabb
1 changed files with 6 additions and 1 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue