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
This commit is contained in:
Stefan Farfeleder 2005-09-10 08:19:58 +00:00
parent 71270ca60b
commit 2340828b1e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149932

View File

@ -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);