summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorcracauer <cracauer@FreeBSD.org>1999-04-03 12:55:51 +0000
committercracauer <cracauer@FreeBSD.org>1999-04-03 12:55:51 +0000
commit1ea5fe55b8ca8931c160e2d26f6476338beb5bfa (patch)
tree1d6e546e06990587e180b46ca327d6cb19784ec4 /bin
parent0ceecd2eef29eed3f77c415cc3265939d2c9e740 (diff)
downloadFreeBSD-src-1ea5fe55b8ca8931c160e2d26f6476338beb5bfa.zip
FreeBSD-src-1ea5fe55b8ca8931c160e2d26f6476338beb5bfa.tar.gz
In interactive shells, break loops to the topmost level when a child
is killed by a signal. (In non-interactive shells - that means a shellscript - the shell just exits, this was already working) PR: bin/9173
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/eval.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 8b4fb62f..36552c4 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -39,11 +39,12 @@
static char sccsid[] = "@(#)eval.c 8.9 (Berkeley) 6/8/95";
#endif
static const char rcsid[] =
- "$Id: eval.c,v 1.15 1998/05/18 06:43:34 charnier Exp $";
+ "$Id: eval.c,v 1.16 1999/04/01 13:27:35 cracauer Exp $";
#endif /* not lint */
#include <signal.h>
#include <unistd.h>
+#include <sys/wait.h> /* For WIFSIGNALED(status) */
/*
* Evaluate a command.
@@ -862,6 +863,10 @@ parent: /* parent process gets here (if we forked) */
INTOFF;
exitstatus = waitforjob(jp);
INTON;
+ if (iflag && loopnest > 0 && WIFSIGNALED(exitstatus)) {
+ evalskip = SKIPBREAK;
+ skipcount = loopnest;
+ }
} else if (mode == 2) {
backcmd->fd = pip[0];
close(pip[1]);
OpenPOWER on IntegriCloud