diff options
author | steve <steve@FreeBSD.org> | 1996-10-22 03:02:07 +0000 |
---|---|---|
committer | steve <steve@FreeBSD.org> | 1996-10-22 03:02:07 +0000 |
commit | 0fef6071c45d0ef2107c8f9255c052c59668a6b7 (patch) | |
tree | ceb3c6ea271c592a303f4b8a497a950add875c33 /bin | |
parent | 341ed58244435485549b67245725fb9bfdfee657 (diff) | |
download | FreeBSD-src-0fef6071c45d0ef2107c8f9255c052c59668a6b7.zip FreeBSD-src-0fef6071c45d0ef2107c8f9255c052c59668a6b7.tar.gz |
Close PR# 1206. sh(1) now ignores SIGINT and SIGQUIT
when a child is forked and the -c commandline switch
has been specified.
Reviewed by: joerg
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/eval.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 800fc87..c5bb7d4 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: eval.c,v 1.5 1996/09/01 10:19:57 peter Exp $ + * $Id: eval.c,v 1.6 1996/10/06 15:17:19 steve Exp $ */ #ifndef lint @@ -210,7 +210,6 @@ evaltree(n, flags) case NAND: evaltree(n->nbinary.ch1, EV_TESTED); if (evalskip || exitstatus != 0) { - /* don't bomb out on "set -e; false && true" */ flags |= EV_TESTED; goto out; } @@ -855,7 +854,24 @@ cmddone: parent: /* parent process gets here (if we forked) */ if (mode == 0) { /* argument to fork */ INTOFF; - exitstatus = waitforjob(jp); + if (minusc) { + struct sigaction iact, qact, oiact, oqact; + + (void)sigaction(SIGINT, (struct sigaction *)NULL, &oiact); + (void)sigaction(SIGQUIT, (struct sigaction *)NULL, &oqact); + + iact = oiact; + qact = oqact; + + qact.sa_handler = iact.sa_handler = SIG_IGN; + + (void)sigaction(SIGINT, &iact, (struct sigaction *)NULL); + (void)sigaction(SIGQUIT, &qact, (struct sigaction *)NULL); + exitstatus = waitforjob(jp); + (void)sigaction(SIGINT, &oiact, (struct sigaction *)NULL); + (void)sigaction(SIGQUIT, &oqact, (struct sigaction *)NULL); + } else + exitstatus = waitforjob(jp); INTON; } else if (mode == 2) { backcmd->fd = pip[0]; |