diff options
author | 2013-06-15 17:25:19 +0000 | |
---|---|---|
committer | 2013-06-15 17:25:19 +0000 | |
commit | c8810b77ee2f12177daf1d44cdef2ddfe968e7c7 (patch) | |
tree | babcfc9e995fd613cd52a2e174612974ca8c9383 | |
parent | Hook up locale(1). (diff) | |
download | wireguard-openbsd-c8810b77ee2f12177daf1d44cdef2ddfe968e7c7.tar.xz wireguard-openbsd-c8810b77ee2f12177daf1d44cdef2ddfe968e7c7.zip |
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@
-rw-r--r-- | bin/ksh/main.c | 6 |
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; } |