From 594ad37c37540735068e24387db7fbf524de9c8c Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 13 Oct 2001 17:54:28 +0000 Subject: Save/restore state around DEBUG trap call. --- ChangeLog | 6 ++++++ Src/exec.c | 11 +++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1f2573921..931e2fd1a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-10-11 Bart Schaefer + + * 16013: Src/exec.c: Properly save/restore state around the + DEBUG trap, so that its return value does not alter the return + value of current command (among other things). + 2001-10-11 Sven Wischnowsky * 16002: Completion/Unix/Type/_path_files: use expanded paths diff --git a/Src/exec.c b/Src/exec.c index 7bc341116..ed8293b24 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -886,11 +886,18 @@ execlist(Estate state, int dont_change_job, int exiting) state->pc--; sublist_done: - cmdsp = csp; noerrexit = oldnoerrexit; - if (sigtrapped[SIGDEBUG]) + if (sigtrapped[SIGDEBUG]) { + exiting = donetrap; + ret = lastval; dotrap(SIGDEBUG); + lastval = ret; + donetrap = exiting; + noerrexit = oldnoerrexit; + } + + cmdsp = csp; /* Check whether we are suppressing traps/errexit * * (typically in init scripts) and if we haven't * -- cgit 1.4.1