summaryrefslogtreecommitdiffstats
path: root/bin/sh/jobs.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2009-12-25 20:21:35 +0000
committerjilles <jilles@FreeBSD.org>2009-12-25 20:21:35 +0000
commit545cc5fec7115d450d5b76c2f598d1eafb16d592 (patch)
tree70cc7efa48eb3f1089f61e3030e19359262db521 /bin/sh/jobs.c
parent2f4287b1338caa52535b49c6af74ecf62ecdb8ed (diff)
downloadFreeBSD-src-545cc5fec7115d450d5b76c2f598d1eafb16d592.zip
FreeBSD-src-545cc5fec7115d450d5b76c2f598d1eafb16d592.tar.gz
sh: Do not run callers' exception handlers in subshells.
Reset the exception handler in the child to main's. This avoids inappropriate double cleanups or shell duplication when the exception is caught, such as 'fc' and future 'command eval' and 'command .'.
Diffstat (limited to 'bin/sh/jobs.c')
-rw-r--r--bin/sh/jobs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 1ebf722..95ec6e2 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -757,6 +757,7 @@ forkshell(struct job *jp, union node *n, int mode)
TRACE(("Child shell %d\n", (int)getpid()));
wasroot = rootshell;
rootshell = 0;
+ handler = &main_handler;
closescript();
INTON;
clear_traps();
OpenPOWER on IntegriCloud