From e01223a26cb7afd9f44805f067c4dcdad06039b0 Mon Sep 17 00:00:00 2001
From: Peter Stephenson
Date: Sun, 2 Feb 2020 18:05:47 +0000
Subject: 45373: Fix ERR_EXIT bug in else branch of if.
The flags need resetting for this branch otherwise e.g. command
substitution with non-zero status doesn't cause exit.
---
Src/loop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'Src/loop.c')
diff --git a/Src/loop.c b/Src/loop.c
index 538afb8dc..01abc6cc9 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -570,7 +570,7 @@ execif(Estate state, int do_exec)
if (run) {
/* we need to ignore lastval until we reach execcmd() */
- if (olderrexit)
+ if (olderrexit || run == 2)
noerrexit = olderrexit;
else if (lastval)
noerrexit |= NOERREXIT_EXIT | NOERREXIT_RETURN | NOERREXIT_UNTIL_EXEC;
--
cgit 1.4.1