summaryrefslogtreecommitdiff
path: root/Src/exec.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-05-13 16:17:04 +0100
committerPeter Stephenson <pws@zsh.org>2015-05-13 16:17:04 +0100
commitec57c91b586a7682fcdb08c3704c9214cddfa5e7 (patch)
tree6baa5dd3f864f4ddec5496c29913a13e7a00f16f /Src/exec.c
parent9c3aeef99a64c44e5a37170c9440c591f223bb4a (diff)
downloadzsh-ec57c91b586a7682fcdb08c3704c9214cddfa5e7.tar.gz
zsh-ec57c91b586a7682fcdb08c3704c9214cddfa5e7.zip
users/20203: nested functions in always blocks when exit pending
Diffstat (limited to 'Src/exec.c')
-rw-r--r--Src/exec.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 6a8b35a36..527dffba8 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -5101,7 +5101,15 @@ doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval)
}
popheap();
- if (exit_pending) {
+ /*
+ * Exit with a tidy up.
+ * Only leave if we're at the end of the appropriate function ---
+ * not a nested function. As we usually skip the function body,
+ * the only likely case where we need that second test is
+ * when we have an "always" block. The endparamscope() has
+ * already happened, hence the "+1" here.
+ */
+ if (exit_pending && exit_level == locallevel+1) {
if (locallevel > forklevel) {
/* Still functions to return: force them to do so. */
retflag = 1;