summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2018-06-20 12:09:43 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2018-06-20 12:09:43 +0100
commiteada7e1138a3fca90f085dd764ad86098e58c9ac (patch)
treeec7df71375da7ac82ea9c67f2fa6685b92a42239
parent7caec474de577e59a6cf45952e5b87712967aa45 (diff)
downloadzsh-eada7e1138a3fca90f085dd764ad86098e58c9ac.tar.gz
zsh-eada7e1138a3fca90f085dd764ad86098e58c9ac.tar.xz
zsh-eada7e1138a3fca90f085dd764ad86098e58c9ac.zip
43077: Fix shift builtin status.
If the math evaulation to get the shift count failed the status
wasn't passed back from the builtin.
-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();