Commits

Victor Stinner  committed 7d821a0 Draft

faulthandler: fix the handler of user signals

Restore the errno before calling the previous signal handler, and not after.

  • Participants
  • Parent commits b3e56aa

Comments (0)

Files changed (1)

File Modules/faulthandler.c

 #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