diff options
author | jilles <jilles@FreeBSD.org> | 2013-04-12 15:19:35 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2013-04-12 15:19:35 +0000 |
commit | 8b2029265883067bf67b0fa209dd4f6e47c48e3f (patch) | |
tree | 0aac568cbf8c2959f1e1a7008c5231687838385b /bin | |
parent | fd27383897a40fb960ee449c2c656b991babd97d (diff) | |
download | FreeBSD-src-8b2029265883067bf67b0fa209dd4f6e47c48e3f.zip FreeBSD-src-8b2029265883067bf67b0fa209dd4f6e47c48e3f.tar.gz |
sh: Don't modify exit status when break/continue/return passes !.
This matches what would happen if ! P were to be replaced with
if P; then false; else true; fi.
Example:
f() { ! return 0; }; f
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/eval.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/bin/sh/eval.c b/bin/sh/eval.c index 0972b10..d3708b3 100644 --- a/bin/sh/eval.c +++ b/bin/sh/eval.c @@ -279,6 +279,8 @@ evaltree(union node *n, int flags) break; case NNOT: evaltree(n->nnot.com, EV_TESTED); + if (evalskip) + goto out; exitstatus = !exitstatus; break; |