diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2009-06-25 22:57:46 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-06-25 22:57:46 +0200 |
commit | 31c91b4357905486e81f901ad079da5735bdb7ba (patch) | |
tree | d6caeb0b0d3db61a19404bb65574adb8cc9029a5 /mg.c | |
parent | 05b4f1ece255de95efcc5a4c74e28b5d04f54401 (diff) | |
download | perl-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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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]++; |