From 35160540ac2cc0244d9304c790e4abb6afb5aed5 Mon Sep 17 00:00:00 2001 From: Martin Cracauer Date: Sun, 28 Nov 1999 13:52:22 +0000 Subject: MFC: Fixes for bin/14509 (';' command when used with -e flag) and bin/14527 (here-backquote-longpipe) --- bin/sh/eval.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'bin') 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); -- cgit v1.3