From: Victor Stinner Date: Thu, 9 Aug 2012 00:43:41 +0000 (+0200) Subject: faulthandler: fix the handler of user signals X-Git-Tag: v3.3.0b2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3cc635dabb0780914d51cdfad57912608196d099;p=thirdparty%2FPython%2Fcpython.git faulthandler: fix the handler of user signals Restore the errno before calling the previous signal handler, and not after. --- diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c index 469e49026836..4aa91242638f 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