summary refs log tree commit diff
path: root/src/trap.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/trap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/trap.c b/src/trap.c
index ab0ecd4..58a7c60 100644
--- a/src/trap.c
+++ b/src/trap.c
@@ -41,6 +41,7 @@
 #include "main.h"
 #include "nodes.h"	/* for other headers */
 #include "eval.h"
+#include "init.h"
 #include "jobs.h"
 #include "show.h"
 #include "options.h"
@@ -397,8 +398,10 @@ exitshell(void)
 		trap[0] = NULL;
 		evalskip = 0;
 		evalstring(p, 0);
+		evalskip = SKIPFUNCDEF;
 	}
 out:
+	exitreset();
 	/*
 	 * Disable job control so that whoever had the foreground before we
 	 * started can get it back.
@@ -406,7 +409,7 @@ out:
 	if (likely(!setjmp(loc.loc)))
 		setjobctl(0);
 	flushall();
-	_exit(savestatus);
+	_exit(exitstatus);
 	/* NOTREACHED */
 }