summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2012-06-24 01:23:49 -0500
committerJesse Luehrs <doy@tozt.net>2012-06-24 01:36:07 -0500
commit100c03aac5095ceefd0a78fa21d9293c2439ef2f (patch)
treec748335669136b6f2771c84e2ea7478397d1525a /mg.c
parent123a72adf67212f99c8db130ce728ddd19243287 (diff)
downloadperl-100c03aac5095ceefd0a78fa21d9293c2439ef2f.tar.gz
don't let arriving signals reset $@ [perl #45173]
since signals can arrive at any point, clearing $@ isn't a safe thing to do
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 8cfee10824..14965da0a8 100644
--- a/mg.c
+++ b/mg.c
@@ -3111,6 +3111,7 @@ Perl_sighandler(int sig)
U32 flags = 0;
XPV * const tXpv = PL_Xpv;
I32 old_ss_ix = PL_savestack_ix;
+ SV *errsv_save = NULL;
if (!PL_psig_ptr[sig]) {
@@ -3189,10 +3190,13 @@ Perl_sighandler(int sig)
#endif
PUTBACK;
+ errsv_save = newSVsv(ERRSV);
+
call_sv(MUTABLE_SV(cv), G_DISCARD|G_EVAL);
POPSTACK;
if (SvTRUE(ERRSV)) {
+ SvREFCNT_dec(errsv_save);
#ifndef PERL_MICRO
/* Handler "died", for example to get out of a restart-able read().
* Before we re-do that on its behalf re-enable the signal which was
@@ -3216,6 +3220,11 @@ Perl_sighandler(int sig)
#endif /* !PERL_MICRO */
die_sv(ERRSV);
}
+ else {
+ sv_setsv(ERRSV, errsv_save);
+ SvREFCNT_dec(errsv_save);
+ }
+
cleanup:
/* pop any of SAVEFREESV, SAVEDESTRUCTOR_X and "save in progress" */
PL_savestack_ix = old_ss_ix;