about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/exec.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 0eae51f8f..56a5cdbb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-09-27  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 41767: Src/exec.c: preserve nonzero exit status on interrupt
+
 2017-09-27  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 41764 (test tweaked): Doc/Zsh/params.yo, Src/params.c,
diff --git a/Src/exec.c b/Src/exec.c
index 161d4ac5e..0d2dc4ebb 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -3199,7 +3199,8 @@ execcmd_exec(Estate state, Execcmd_params eparams,
     }
 
     if (errflag) {
-	lastval = 1;
+	if (!lastval)
+	    lastval = 1;
 	if (oautocont >= 0)
 	    opts[AUTOCONTINUE] = oautocont;
 	return;