summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorSlaven Rezic <slaven@rezic.de>2003-02-14 10:11:15 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2003-02-24 19:56:23 +0000
commit2fb44b4522b8956ab337b2f83a5fe619b0773788 (patch)
tree36f18147459dbf0212baedf99639d43f5b3563bb /mg.c
parentdb79b45b3c913399aef4d2f3647453e63c4772a8 (diff)
downloadperl-2fb44b4522b8956ab337b2f83a5fe619b0773788.tar.gz
Re: [perl #20920] Segmentation fault ("Safe Signal" queue problem?)
Message-ID: <878ywji8nw.fsf@vran.herceg.de> (with slight tweaks) p4raw-id: //depot/perl@18765
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index 20673bf720..81e1ac618d 100644
--- a/mg.c
+++ b/mg.c
@@ -1159,8 +1159,26 @@ Perl_despatch_signals(pTHX)
PL_sig_pending = 0;
for (sig = 1; sig < SIG_SIZE; sig++) {
if (PL_psig_pend[sig]) {
- PL_psig_pend[sig] = 0;
- (*PL_sighandlerp)(sig);
+#define PERL_BLOCK_SIGNALS
+#if defined(HAS_SIGPROCMASK) && defined(PERL_BLOCK_SIGNALS)
+# define BLOCK_SIGNALS_WITH_SIGPROCMASK
+#endif
+#ifdef BLOCK_SIGNALS_WITH_SIGPROCMASK
+ /* From sigaction(2) (FreeBSD man page):
+ * | Signal routines normally execute with the signal that
+ * | caused their invocation blocked, but other signals may
+ * | yet occur.
+ * Emulate this behavior.
+ */
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set,sig);
+#endif
+ PL_psig_pend[sig] = 0;
+#ifdef BLOCK_SIGNALS_WITH_SIGPROCMASK
+ sigprocmask(SIG_BLOCK, &set, NULL);
+#endif
+ (*PL_sighandlerp)(sig);
}
}
}