summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-10-30 21:36:15 +0000
committerjilles <jilles@FreeBSD.org>2013-10-30 21:36:15 +0000
commitf49e62a7ebc015c676ff2b04854d9d6f74c24f8e (patch)
treecf8dba030a6e798646ecaa5e0dc061b40914e39d /bin
parent8bc610b2eafd68d42bb16ccfbbbb4462233afcf1 (diff)
downloadFreeBSD-src-f49e62a7ebc015c676ff2b04854d9d6f74c24f8e.zip
FreeBSD-src-f49e62a7ebc015c676ff2b04854d9d6f74c24f8e.tar.gz
sh: Allow trapping SIGINT/SIGQUIT after ignore because of '&'.
If job control is not enabled, background jobs started with ... & ignore SIGINT and SIGQUIT so that they are not affected by such signals that are intended for the foreground job. However, this should not prevent reassigning a different action for these signals (as if the shell invocation inherited these signal actions from its parent). Austin group issue #751 Example: { trap - INT; exec sleep 10; } & wait A Ctrl+C should terminate the sleep command.
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/trap.c4
1 files changed, 3 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;
}
OpenPOWER on IntegriCloud