summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2014-04-20 11:09:51 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2014-04-20 11:09:51 -0700
commit9da59238ff3163de41800c82d6304b9a09307fcf (patch)
tree8f17de1268ad0081dd213f1841cce2ee63c45623
parent848badaa5f0a18ca3388016d49ffc340b6c2d0c6 (diff)
downloadzsh-9da59238ff3163de41800c82d6304b9a09307fcf.tar.gz
zsh-9da59238ff3163de41800c82d6304b9a09307fcf.zip
32569: lastval ($?) should not be reset between word list substitution and loop body execution in for/select
Remove one other redundant and therefore confusing assignment to lastval.
-rw-r--r--ChangeLog3
-rw-r--r--Src/loop.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e79faae4..07ee44a2e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2014-04-20 Barton E. Schaefer <schaefer@zsh.org>
+ * 32569: Src/loop.c: lastval ($?) should not be reset between
+ word list substitution and loop body execution in for/select.
+
* 32568: Src/exec.c, Src/loop.c: consistency in handling of errflag
condition during substitutions in for/select word lists, function
definition name position, and anonymous function argument lists.
diff --git a/Src/loop.c b/Src/loop.c
index dc8f2320f..2f639fd5a 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -73,7 +73,7 @@ execfor(Estate state, int do_exec)
matheval(str);
if (errflag) {
state->pc = end;
- return lastval = errflag;
+ return 1;
}
cond = ecgetstr(state, EC_NODUP, &ctok);
advance = ecgetstr(state, EC_NODUP, &atok);
@@ -102,7 +102,7 @@ execfor(Estate state, int do_exec)
addlinknode(args, dupstring(*x));
}
}
- lastval = 0;
+ /* lastval = 0; */
loops++;
pushheap();
cmdpush(CS_FOR);
@@ -241,7 +241,7 @@ execselect(Estate state, UNUSED(int do_exec))
return 1;
}
loops++;
- lastval = 0;
+ /* lastval = 0; */
pushheap();
cmdpush(CS_SELECT);
usezle = interact && SHTTY != -1 && isset(USEZLE);