aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMartin Cracauer <cracauer@FreeBSD.org>1999-11-28 13:52:22 +0000
committerMartin Cracauer <cracauer@FreeBSD.org>1999-11-28 13:52:22 +0000
commit35160540ac2cc0244d9304c790e4abb6afb5aed5 (patch)
tree9969cdc9002b74ade75d9a75c376468481278e8a /bin
parentf42675cd3d132f52d792af2fe1d396c5654e805e (diff)
Notes
Diffstat (limited to 'bin')
-rw-r--r--bin/sh/eval.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c
index 341fbab16f06..0699a6698391 100644
--- a/bin/sh/eval.c
+++ b/bin/sh/eval.c
@@ -275,7 +275,14 @@ evaltree(n, flags)
out:
if (pendingsigs)
dotrap();
- if ((flags & EV_EXIT) || (eflag && exitstatus && !(flags & EV_TESTED)))
+ /*
+ * XXX - Like "!(n->type == NSEMI)", more types will probably
+ * need to be excluded from this test. It's probably better
+ * to set or unset EV_TESTED in the loop above than to bloat
+ * the conditional here.
+ */
+ if ((flags & EV_EXIT) || (eflag && exitstatus
+ && !(flags & EV_TESTED) && !(n->type == NSEMI)))
exitshell(exitstatus);
}
@@ -492,7 +499,8 @@ evalpipe(n)
close(prevfd);
}
if (pip[1] >= 0) {
- close(pip[0]);
+ if (!(prevfd >= 0 && pip[0] == 0))
+ close(pip[0]);
if (pip[1] != 1) {
close(1);
copyfd(pip[1], 1);