diff options
author | Peter Stephenson <p.stephenson@samsung.com> | 2021-05-06 10:03:27 +0100 |
---|---|---|
committer | Peter Stephenson <p.stephenson@samsung.com> | 2021-05-06 10:03:27 +0100 |
commit | 9e38ab81785c4ac755a7e78d2fe7a7db92bdf375 (patch) | |
tree | 6b9bbcb6fbfd2f987656d837b3f338037086436f /Src | |
parent | c1f932d66896753eb118003b7c1b1139bc6c8725 (diff) | |
download | zsh-9e38ab81785c4ac755a7e78d2fe7a7db92bdf375.tar.gz zsh-9e38ab81785c4ac755a7e78d2fe7a7db92bdf375.tar.xz zsh-9e38ab81785c4ac755a7e78d2fe7a7db92bdf375.zip |
48787: Fix command status after failed if
If "if" had a hard error in the condition, and there was no else clause, the command status was incorrectly cleared to zero. Add test.
Diffstat (limited to 'Src')
-rw-r--r-- | Src/loop.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/loop.c b/Src/loop.c index 41b2e5627..aa733a2cb 100644 --- a/Src/loop.c +++ b/Src/loop.c @@ -583,7 +583,7 @@ execif(Estate state, int do_exec) cmdpop(); } else { noerrexit = olderrexit; - if (!retflag) + if (!retflag && !errflag) lastval = 0; } state->pc = end; |