about summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-06-26 10:12:30 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-06-26 10:12:30 +0000
commitbe6c618c3761522526808db1536262ebebb14d3e (patch)
tree63a6606ed4f1c4f4800e2f41691c6a561e910277 /Src/builtin.c
parent5de3c9dc9dac2affa383d7efac17d086578c3e9c (diff)
downloadzsh-be6c618c3761522526808db1536262ebebb14d3e.tar.gz
zsh-be6c618c3761522526808db1536262ebebb14d3e.tar.xz
zsh-be6c618c3761522526808db1536262ebebb14d3e.zip
22317: exiting shell from fork within function screwed status
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index 0d729aab0..1af193f8f 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4092,12 +4092,15 @@ bin_break(char *name, char **argv, UNUSED(Options 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.
+	     *
+	     * If we are forked, we exit the shell at the function depth
+	     * at which we became a subshell, hence the comparison.
 	     */
 	    if (stopmsg || (zexit(0,2), !stopmsg)) {
 		retflag = 1;