rt77432: sigaction would crash/assert with a replaced %SIG
authorTony Cook <tony@develop-help.com>
Mon, 30 Aug 2010 14:34:19 +0000 (00:34 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 30 Aug 2010 14:34:19 +0000 (00:34 +1000)
ext/POSIX/POSIX.xs
ext/POSIX/t/sigaction.t

index 7bdd633..2b9af95 100644 (file)
@@ -1471,7 +1471,7 @@ sigaction(sig, optaction, oldaction = 0)
                   right settings, including appropriate interpretation
                   of DEFAULT and IGNORE.  However, why are we doing
                   this when we're about to do it again just below?  XXX */
-               mg_set(*sigsvp);
+               SvSETMAGIC(*sigsvp);
 
                /* And here again we duplicate -- DEFAULT/IGNORE checking. */
                if(SvPOK(*svp)) {
index bb1b715..5e2a6ad 100644 (file)
@@ -11,7 +11,7 @@ BEGIN{
        }
 }
 
-use Test::More tests => 31;
+use Test::More tests => 32;
 
 use strict;
 use vars qw/$bad $bad7 $ok10 $bad18 $ok/;
@@ -204,3 +204,10 @@ SKIP: {
 eval { sigaction(-999, "foo"); };
 like($@, qr/Negative signals/,
     "Prevent negative signals instead of core dumping");
+
+# RT 77432 - assertion failure with POSIX::SigAction
+{
+  local *SIG = {};
+  ok(sigaction(SIGHUP, POSIX::SigAction->new),
+     "sigaction would crash/assert with a replaced %SIG");
+}