diff options
-rw-r--r-- | mg.c | 4 | ||||
-rw-r--r-- | t/op/sigdispatch.t | 12 |
2 files changed, 11 insertions, 5 deletions
@@ -3001,7 +3001,7 @@ Perl_whichsig(pTHX_ const char *sig) Signal_t #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) -Perl_sighandler(int sig, siginfo_t *sip, void *uap PERL_UNUSED_DECL) +Perl_sighandler(int sig, siginfo_t *sip, void *uap) #else Perl_sighandler(int sig) #endif @@ -3113,7 +3113,7 @@ Perl_sighandler(int sig) */ #ifdef HAS_SIGPROCMASK #if defined(HAS_SIGACTION) && defined(SA_SIGINFO) - if (sip) + if (sip || uap) #endif { sigset_t set; diff --git a/t/op/sigdispatch.t b/t/op/sigdispatch.t index 3a0138a6f5..3d92a39a32 100644 --- a/t/op/sigdispatch.t +++ b/t/op/sigdispatch.t @@ -9,7 +9,7 @@ BEGIN { use strict; use Config; -plan tests => 13; +plan tests => 15; watchdog(10); @@ -39,7 +39,7 @@ eval { is($@, "Alarm!\n", 'after the second loop'); SKIP: { - skip('We can\'t test blocking without sigprocmask', 9) if $ENV{PERL_CORE_MINITEST} || !$Config{d_sigprocmask}; + skip('We can\'t test blocking without sigprocmask', 11) if $ENV{PERL_CORE_MINITEST} || !$Config{d_sigprocmask}; require POSIX; my $new = POSIX::SigSet->new(&POSIX::SIGUSR1); @@ -74,6 +74,12 @@ SKIP: { # test unsafe signal handlers in combination with exceptions my $action = POSIX::SigAction->new(sub { $gotit--, die }, POSIX::SigSet->new, 0); POSIX::sigaction(&POSIX::SIGALRM, $action); - eval { alarm 1; POSIX::sigsuspend(POSIX::SigSet->new) } for 1..2; + eval { + alarm 1; + my $set = POSIX::SigSet->new; + POSIX::sigprocmask(&POSIX::SIG_BLOCK, undef, $set); + is $set->ismember(&POSIX::SIGALRM), 0, "SIGALRM is not blocked on attempt $_"; + POSIX::sigsuspend($set); + } for 1..2; is $gotit, 0, 'Received both signals'; } |