From cc0d931682835347316144a3889fbf35e6d6459b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Mon, 8 Oct 2001 08:13:11 +0000 Subject: 15931: EXIT traps from exit in subshell; 15965: glob -> zglob --- Src/builtin.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Src/builtin.c') 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; -- cgit 1.4.1