From 31f6b3fb07ec0d5816c2dabbc314009c3126b58b Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Thu, 2 Mar 2006 22:05:21 +0000 Subject: 22317: exit status from code backgrounded in function 22277, 22281, tweaks: standardize behaviour of wait builtin with trapped signals --- Src/builtin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Src/builtin.c') diff --git a/Src/builtin.c b/Src/builtin.c index 1b7e1935e..d51149ec6 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -4119,12 +4119,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; -- cgit 1.4.1