about summary refs log tree commit diff
path: root/Src/loop.c
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2022-11-08 20:36:49 -0800
committerBart Schaefer <schaefer@zsh.org>2022-11-08 20:36:49 -0800
commitd873ed6026d7b0c48d6e65ec06df491d015a4d59 (patch)
tree307d5a07b8fd0b269c03310ce24f50e13e8a2f36 /Src/loop.c
parent298919f43a565cc2e130c8cb3f67773f7a54fca1 (diff)
downloadzsh-d873ed6026d7b0c48d6e65ec06df491d015a4d59.tar.gz
zsh-d873ed6026d7b0c48d6e65ec06df491d015a4d59.tar.xz
zsh-d873ed6026d7b0c48d6e65ec06df491d015a4d59.zip
50897: nonzero status of complex commands should trigger ERR_EXIT
Diffstat (limited to 'Src/loop.c')
-rw-r--r--Src/loop.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/Src/loop.c b/Src/loop.c
index db5b3e097..be5261369 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -208,7 +208,7 @@ execfor(Estate state, int do_exec)
     loops--;
     simple_pline = old_simple_pline;
     state->pc = end;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
     return lastval;
 }
 
@@ -336,7 +336,7 @@ execselect(Estate state, UNUSED(int do_exec))
     loops--;
     simple_pline = old_simple_pline;
     state->pc = end;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
     return lastval;
 }
 
@@ -478,7 +478,7 @@ execwhile(Estate state, UNUSED(int do_exec))
     popheap();
     loops--;
     state->pc = end;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
     return lastval;
 }
 
@@ -532,7 +532,7 @@ execrepeat(Estate state, UNUSED(int do_exec))
     loops--;
     simple_pline = old_simple_pline;
     state->pc = end;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
     return lastval;
 }
 
@@ -587,7 +587,7 @@ execif(Estate state, int do_exec)
 	    lastval = 0;
     }
     state->pc = end;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
 
     return lastval;
 }
@@ -701,7 +701,7 @@ execcase(Estate state, int do_exec)
 
     if (!anypatok)
 	lastval = 0;
-    this_noerrexit = 1;
+    this_noerrexit = (WC_SUBLIST_TYPE(*end) != WC_SUBLIST_END);
 
     return lastval;
 }