about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 4ed4acefe..12922e338 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-09-26  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 41761: Src/exec.c: Ensure status from interrupt is propagated
+	from builtin.
+
 2017-09-25  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 41747: Sr/hist.c, Src/params.c, Src/subst.c. Src/zsh.h: add
diff --git a/Src/exec.c b/Src/exec.c
index bd242d140..161d4ac5e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3999,8 +3999,15 @@ execcmd_exec(Estate state, Execcmd_params eparams,
 		    state->pc = opc;
 		}
 		dont_queue_signals();
-		if (!errflag)
-		    lastval = execbuiltin(args, assigns, (Builtin) hn);
+		if (!errflag) {
+		    int ret = execbuiltin(args, assigns, (Builtin) hn);
+		    /*
+		     * In case of interruption assume builtin status
+		     * is less useful than what interrupt set.
+		     */
+		    if (!(errflag & ERRFLAG_INT))
+			lastval = ret;
+		}
 		if (do_save & BINF_COMMAND)
 		    errflag &= ~ERRFLAG_ERROR;
 		restore_queue_signals(q);