summaryrefslogtreecommitdiff
path: root/bin/ksh/main.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2013-06-15 17:25:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2013-06-15 17:25:20 +0000
commitc1abe07dcb5e7b699f65cfeebd863e2dd862b6c3 (patch)
tree7f37ea85aa51933807d937475b2e94014403ace7 /bin/ksh/main.c
parent42f16e297d57cbc81d896e59d073fd2b23da58a7 (diff)
Run any pending traps before calling the EXIT or ERR traps when -e
is set. Fixes a bug where we would not run the signal trap if, for example, ^C was pressed and -e was set. OK espie@
Diffstat (limited to 'bin/ksh/main.c')
-rw-r--r--bin/ksh/main.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c
index e4a6f0e7202..9467978b976 100644
--- a/bin/ksh/main.c
+++ b/bin/ksh/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.51 2012/09/10 01:25:30 tedu Exp $ */
+/* $OpenBSD: main.c,v 1.52 2013/06/15 17:25:19 millert Exp $ */
/*
* startup, main loop, environments and error handling
@@ -612,9 +612,13 @@ unwind(int i)
/* ordering for EXIT vs ERR is a bit odd (this is what at&t ksh does) */
if (i == LEXIT || (Flag(FERREXIT) && (i == LERROR || i == LINTR) &&
sigtraps[SIGEXIT_].trap)) {
+ if (trap)
+ runtraps(0);
runtrap(&sigtraps[SIGEXIT_]);
i = LLEAVE;
} else if (Flag(FERREXIT) && (i == LERROR || i == LINTR)) {
+ if (trap)
+ runtraps(0);
runtrap(&sigtraps[SIGERR_]);
i = LLEAVE;
}