diff options
author | stefanf <stefanf@FreeBSD.org> | 2005-09-10 08:19:58 +0000 |
---|---|---|
committer | stefanf <stefanf@FreeBSD.org> | 2005-09-10 08:19:58 +0000 |
commit | 2485a74343577b25f8e4fdb207039372ba58d9fa (patch) | |
tree | 1aba65323d9101fe135a460a0e513a4b84fae6cc | |
parent | 4ca45af625a09977cd8bfe7b0a129ed3c3e22f06 (diff) | |
download | FreeBSD-src-2485a74343577b25f8e4fdb207039372ba58d9fa.zip FreeBSD-src-2485a74343577b25f8e4fdb207039372ba58d9fa.tar.gz |
Pass the EV_TESTED flag to the left operand of NSEMI nodes. This fixes
two cases of unwanted termination with set -e:
* if-commands containing several commands separated by semicolons, eg
if false; false; then [...]
* functions with an explicitely tested exit status that contain a failing
command which is not the last one, eg
f() {
false
false
}
f || true
PR: 77067, 85267
Briefly reviewed by: cracauer
-rw-r--r-- | bin/sh/eval.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index a91f9db..ada2a78 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -196,7 +196,7 @@ evaltree(union node *n, int flags) TRACE(("evaltree(%p: %d) called\n", (void *)n, n->type)); switch (n->type) { case NSEMI: - evaltree(n->nbinary.ch1, 0); + evaltree(n->nbinary.ch1, flags & ~EV_EXIT); if (evalskip) goto out; evaltree(n->nbinary.ch2, flags); |