about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2001-10-08 08:13:11 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2001-10-08 08:13:11 +0000
commitcc0d931682835347316144a3889fbf35e6d6459b (patch)
treed44ca57420c50af42aee06df6fc525dec16c95cc /Src/builtin.c
parentb109834dc2d3e86ac4bed09a7957d6ba9d2f517a (diff)
downloadzsh-cc0d931682835347316144a3889fbf35e6d6459b.tar.gz
zsh-cc0d931682835347316144a3889fbf35e6d6459b.tar.xz
zsh-cc0d931682835347316144a3889fbf35e6d6459b.zip
15931: EXIT traps from exit in subshell; 15965: glob -> zglob
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 6db40006a..4ccc26314 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3429,12 +3429,16 @@ bin_break(char *name, char **argv, char *ops, int func)
 	}
 	/*FALLTHROUGH*/
     case BIN_EXIT:
-	if (locallevel) {
+	if (locallevel > forklevel) {
 	    /*
 	     * We don't exit directly from functions to allow tidying
 	     * up, in particular EXIT traps.  We still need to perform
 	     * the usual interactive tests to see if we can exit at
 	     * all, however.
+	     *
+	     * The forklevel test means we *do* exit from a subshell
+	     * inside a function when we reach the level of the
+	     * function itself.
 	     */
 	    if (stopmsg || (zexit(0,2), !stopmsg)) {
 		retflag = 1;