about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 526681632..fe91372f9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-20  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 43077: Src/builtin.c: failure of math evaluation didn't
+	propagate to status of shift builtin.
+
 2018-06-20  dana  <dana@dana.is>
 
 	* 43061: Completion/Darwin/Command/_open,
diff --git a/Src/builtin.c b/Src/builtin.c
index 1cba97dec..93fa9112c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -5318,8 +5318,13 @@ bin_shift(char *name, char **argv, Options ops, UNUSED(int func))
 
     /* optional argument can be either numeric or an array */
     queue_signals();
-    if (*argv && !getaparam(*argv))
+    if (*argv && !getaparam(*argv)) {
         num = mathevali(*argv++);
+	if (errflag) {
+	    unqueue_signals();
+	    return 1;
+	}
+    }
 
     if (num < 0) {
 	unqueue_signals();