summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorLeon Timmermans <fawaka@gmail.com>2011-02-12 22:19:57 +0100
committerFather Chrysostomos <sprout@cpan.org>2011-02-17 13:34:04 -0800
commitc22d665b55f24cd837419195a9ef11b09877c9cf (patch)
tree0c00017f7bc9af04329c29badbfd073b52a32681 /mg.c
parent3acb769b7e0a362f74c892536b04646fe37d0929 (diff)
downloadperl-c22d665b55f24cd837419195a9ef11b09877c9cf.tar.gz
Unblock signal-mask on error for unsafe signals
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index c58531e6fc..5b6b339733 100644
--- a/mg.c
+++ b/mg.c
@@ -3106,15 +3106,27 @@ Perl_sighandler(int sig)
POPSTACK;
if (SvTRUE(ERRSV)) {
-#if !defined(PERL_MICRO) && !defined(HAS_SIGPROCMASK)
+#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
* blocked by the system when we entered.
*/
+#ifdef HAS_SIGPROCMASK
+#ifdef HAS_SIGACTION
+ if (sip)
+#endif
+ {
+ sigset_t set;
+ sigemptyset(&set);
+ sigaddset(&set,sig);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
+ }
+#else
/* Not clear if this will work */
(void)rsignal(sig, SIG_IGN);
(void)rsignal(sig, PL_csighandlerp);
-#endif /* !PERL_MICRO && !HAS_SIGPROCMASK*/
+#endif
+#endif /* !PERL_MICRO */
die_sv(ERRSV);
}
cleanup: