summaryrefslogtreecommitdiff
path: root/bin/ksh
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2013-06-10 21:09:28 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2013-06-10 21:09:28 +0000
commite4bea35ba5d41e3fda90f2f739796dcbb20d0d9d (patch)
treef0ac7169927cdf4e59e75138be16f6383872a9b2 /bin/ksh
parent9e175c4a43a294b88e99eeb3eec91df5424892e5 (diff)
POSIX specifies that for an AND/OR list, only the last command's
exit status matters for "set -e". Revert the part of revision 1.49 that always sets xerrok for AND/OR. This makes sh/ksh pass the updated regress tests. OK espie@ jca@
Diffstat (limited to 'bin/ksh')
-rw-r--r--bin/ksh/exec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/bin/ksh/exec.c b/bin/ksh/exec.c
index 1c144fa9c19..a9ae9527cff 100644
--- a/bin/ksh/exec.c
+++ b/bin/ksh/exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exec.c,v 1.49 2009/01/29 23:27:26 jaredy Exp $ */
+/* $OpenBSD: exec.c,v 1.50 2013/06/10 21:09:27 millert Exp $ */
/*
* execute command tree
@@ -228,10 +228,12 @@ execute(struct op *volatile t,
case TAND:
rv = execute(t->left, XERROK, xerrok);
if ((rv == 0) == (t->type == TAND))
- rv = execute(t->right, XERROK, xerrok);
- flags |= XERROK;
- if (xerrok)
- *xerrok = 1;
+ rv = execute(t->right, flags & XERROK, xerrok);
+ else {
+ flags |= XERROK;
+ if (xerrok)
+ *xerrok = 1;
+ }
break;
case TBANG: