summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorLubomir Rintel <lubo.rintel@gooddata.com>2010-07-26 16:05:05 +0200
committerRafael Garcia-Suarez <rgs@consttype.org>2010-07-26 16:06:25 +0200
commitd016601746b09e0f0a7eb2148b6eb594d3992339 (patch)
tree4e1ca2a5523dea59a0931cafbbbb4bcd93dcb10a /mg.c
parent1e8125c621275d18c74bc8dae3bfc3c03929fe1e (diff)
downloadperl-d016601746b09e0f0a7eb2148b6eb594d3992339.tar.gz
Restore errno if signal handler changes it
It's way too easy to forget to "local $!" in signal handlers and changing $! when signal hits between two ops is probably never useful.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/mg.c b/mg.c
index 47844e0867..5eca2e51d4 100644
--- a/mg.c
+++ b/mg.c
@@ -1385,6 +1385,7 @@ Perl_despatch_signals(pTHX)
PL_sig_pending = 0;
for (sig = 1; sig < SIG_SIZE; sig++) {
if (PL_psig_pend[sig]) {
+ dSAVE_ERRNO;
PERL_BLOCKSIG_ADD(set, sig);
PL_psig_pend[sig] = 0;
PERL_BLOCKSIG_BLOCK(set);
@@ -1394,6 +1395,7 @@ Perl_despatch_signals(pTHX)
(*PL_sighandlerp)(sig);
#endif
PERL_BLOCKSIG_UNBLOCK(set);
+ RESTORE_ERRNO;
}
}
}