summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2009-06-25 22:57:46 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-06-25 22:57:46 +0200
commit31c91b4357905486e81f901ad079da5735bdb7ba (patch)
treed6caeb0b0d3db61a19404bb65574adb8cc9029a5 /mg.c
parent05b4f1ece255de95efcc5a4c74e28b5d04f54401 (diff)
downloadperl-31c91b4357905486e81f901ad079da5735bdb7ba.tar.gz
Don't enqueue pending signals during global destruction
Global destruction is not signal-safe. PL_psig_pend may already be gone when the signal handler is called (with destruct_level > 0). NULL it before freeing it to prevent a race condition.
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index e9e4214d5a..05a5092b25 100644
--- a/mg.c
+++ b/mg.c
@@ -1316,13 +1316,14 @@ Perl_csighandler(int sig)
#endif
(PL_signals & PERL_SIGNALS_UNSAFE_FLAG))
/* Call the perl level handler now--
- * with risk we may be in malloc() etc. */
+ * with risk we may be in malloc() or being destructed etc. */
#if defined(HAS_SIGACTION) && defined(SA_SIGINFO)
(*PL_sighandlerp)(sig, NULL, NULL);
#else
(*PL_sighandlerp)(sig);
#endif
else {
+ if (!PL_psig_pend) return;
/* Set a flag to say this signal is pending, that is awaiting delivery after
* the current Perl opcode completes */
PL_psig_pend[sig]++;