summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bin/sh/trap.c4
-rw-r--r--tools/regression/bin/sh/builtins/trap13.08
-rw-r--r--tools/regression/bin/sh/builtins/trap14.010
3 files changed, 21 insertions, 1 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index 3fc8566..1b2c354 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -362,10 +362,12 @@ void
ignoresig(int signo)
{
+ if (sigmode[signo] == 0)
+ setsignal(signo);
if (sigmode[signo] != S_IGN && sigmode[signo] != S_HARD_IGN) {
signal(signo, SIG_IGN);
+ sigmode[signo] = S_IGN;
}
- sigmode[signo] = S_HARD_IGN;
}
diff --git a/tools/regression/bin/sh/builtins/trap13.0 b/tools/regression/bin/sh/builtins/trap13.0
new file mode 100644
index 0000000..d90eb08
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/trap13.0
@@ -0,0 +1,8 @@
+# $FreeBSD$
+
+{
+ trap 'exit 0' INT
+ ${SH} -c 'kill -INT $PPID'
+ exit 3
+} &
+wait $!
diff --git a/tools/regression/bin/sh/builtins/trap14.0 b/tools/regression/bin/sh/builtins/trap14.0
new file mode 100644
index 0000000..97cce8d
--- /dev/null
+++ b/tools/regression/bin/sh/builtins/trap14.0
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+{
+ trap - INT
+ ${SH} -c 'kill -INT $PPID' &
+ wait
+} &
+wait $!
+r=$?
+[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ]
OpenPOWER on IntegriCloud