summaryrefslogtreecommitdiff
path: root/ext/POSIX
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-03-09 16:03:21 +0000
committerSteve Peters <steve@fisharerojo.org>2006-03-09 16:03:21 +0000
commit516d25e8e8c09c6c60bf2f46703fc4d5add0f5fb (patch)
treec54e3ece7af7c741582041a30bcf35c6b635cef9 /ext/POSIX
parent29595ff298b9b71b7461c2281943b6a1566c9e45 (diff)
downloadperl-516d25e8e8c09c6c60bf2f46703fc4d5add0f5fb.tar.gz
croak in POSIX::sigaction() when passed a negative signal instead
dumping core. p4raw-id: //depot/perl@27440
Diffstat (limited to 'ext/POSIX')
-rw-r--r--ext/POSIX/POSIX.xs4
-rw-r--r--ext/POSIX/t/sigaction.t3
2 files changed, 7 insertions, 0 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 730e7e0d8e..50f3a748bc 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -1260,6 +1260,10 @@ sigaction(sig, optaction, oldaction = 0)
SV** svp;
SV** sigsvp;
+ if (sig < 0) {
+ croak("Negative signals are not allowed");
+ }
+
if (sig == 0 && SvPOK(ST(0))) {
const char *s = SvPVX_const(ST(0));
int i = whichsig(s);
diff --git a/ext/POSIX/t/sigaction.t b/ext/POSIX/t/sigaction.t
index 813960a0c9..c33b7320ae 100644
--- a/ext/POSIX/t/sigaction.t
+++ b/ext/POSIX/t/sigaction.t
@@ -205,3 +205,6 @@ SKIP: {
kill 'HUP', $$;
}
+eval { sigaction(-999, "foo"); };
+like($@, qr/Negative signals/,
+ "Prevent negative signals instead of core dumping");