patch from oksh (except manpage, I'll merge that later):
pass "xerrok" status across the execution call stack to more closely match what both POSIX and [18]ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values. specifically, the truth values tested as operands to &&' and ||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed !'), should not make the shell exit when -e is in effect. issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc.
This commit is contained in:
6
main.c
6
main.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: main.c,v 1.44 2008/07/05 07:25:18 djm Exp $ */
|
||||
/* $OpenBSD: main.c,v 1.45 2009/01/29 23:27:26 jaredy Exp $ */
|
||||
/* $OpenBSD: tty.c,v 1.9 2006/03/14 22:08:01 deraadt Exp $ */
|
||||
/* $OpenBSD: io.c,v 1.22 2006/03/17 16:30:13 millert Exp $ */
|
||||
/* $OpenBSD: table.c,v 1.13 2009/01/17 22:06:44 millert Exp $ */
|
||||
@ -13,7 +13,7 @@
|
||||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.121 2009/03/22 17:31:16 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.122 2009/03/22 17:47:37 tg Exp $");
|
||||
|
||||
extern char **environ;
|
||||
|
||||
@ -566,7 +566,7 @@ shell(Source * volatile s, volatile int toplevel)
|
||||
}
|
||||
}
|
||||
if (t && (!Flag(FNOEXEC) || (s->flags & SF_TTY)))
|
||||
exstat = execute(t, 0);
|
||||
exstat = execute(t, 0, NULL);
|
||||
|
||||
if (t != NULL && t->type != TEOF && interactive && really_exit)
|
||||
really_exit = 0;
|
||||
|
Reference in New Issue
Block a user