Commit c925617b authored by Victor Stinner's avatar Victor Stinner

faulthandler: save/restore errno in the two signal handlers

parent 97c3eb4e
......@@ -238,6 +238,7 @@ faulthandler_fatal_error(int signum)
unsigned int i;
fault_handler_t *handler = NULL;
PyThreadState *tstate;
int save_errno = errno;
if (!fatal_error.enabled)
return;
......@@ -285,6 +286,7 @@ faulthandler_fatal_error(int signum)
_Py_DumpTraceback(fd, tstate);
}
errno = save_errno;
#ifdef MS_WINDOWS
if (signum == SIGSEGV) {
/* don't call explictly the previous handler for SIGSEGV in this signal
......@@ -593,6 +595,7 @@ faulthandler_user(int signum)
{
user_signal_t *user;
PyThreadState *tstate;
int save_errno = errno;
user = &user_signals[signum];
if (!user->enabled)
......@@ -614,6 +617,7 @@ faulthandler_user(int signum)
return;
_Py_DumpTraceback(user->fd, tstate);
}
errno = save_errno;
}
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