diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-18 09:08:47 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-06-18 09:08:47 +0000 |
commit | 1d81eac947dedbd62bc60aa6d92509cbe424fa3d (patch) | |
tree | 7208914cda1ad4fe5944e45bba725cf8c62bacf5 /ext/POSIX/t/sigaction.t | |
parent | 702815ca71820e02fb479da23518a6420e31af8b (diff) | |
download | perl-1d81eac947dedbd62bc60aa6d92509cbe424fa3d.tar.gz |
If the first argument of sigaction() was a string, not a number
(or a SIGXXX 'constant') one got first (if using -w) 'Argument "FOO"
isn't numeric in subroutine entry ...' but after that one got
(depending on the OS) either a coredump (because of trying to
assign to *0 in mg_get) or a hang (because of the sigprocmask()
blocking signals inside POSIX::sigaction, a nasty hang since
one obviously cannot interrupt it...only SIGKILL works).
In older Perls (tried with 5.6.1) one got 'No such signal: SIGZERO ...'
because of the string becoming zero due to the XS typemap magic.
Resolved by making the POSIX::sigaction to try harder to figure
out a valid signal number (one still gets the warning, though),
and returning undef if no sense can be made.
p4raw-id: //depot/perl@19809
Diffstat (limited to 'ext/POSIX/t/sigaction.t')
-rw-r--r-- | ext/POSIX/t/sigaction.t | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/ext/POSIX/t/sigaction.t b/ext/POSIX/t/sigaction.t index 63ff17dae3..d2db20b0ff 100644 --- a/ext/POSIX/t/sigaction.t +++ b/ext/POSIX/t/sigaction.t @@ -21,7 +21,7 @@ use vars qw/$bad7 $ok10 $bad18 $ok/; $^W=1; -print "1..18\n"; +print "1..21\n"; sub IGNORE { $bad7=1; @@ -133,3 +133,25 @@ if ($^O eq 'VMS') { print $bad18 ? "not ok 18\n" : "ok 18\n"; } +{ + local $SIG{__WARN__} = sub { }; # Just suffer silently. + + my $hup20; + my $hup21; + + sub hup20 { $hup20++ } + sub hup21 { $hup21++ } + + sigaction("FOOBAR", $newaction); + print "ok 19\n"; # no coredump, still alive + + $newaction = POSIX::SigAction->new("hup20"); + sigaction("SIGHUP", $newaction); + kill "HUP", $$; + print $hup20 == 1 ? "ok 20\n" : "not ok 20\n"; + + $newaction = POSIX::SigAction->new("hup21"); + sigaction("HUP", $newaction); + kill "HUP", $$; + print $hup21 == 1 ? "ok 21\n" : "not ok 21\n"; +} |