aboutsummaryrefslogtreecommitdiff
path: root/bin/sh
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2020-07-09 20:53:56 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2020-07-09 20:53:56 +0000
commitbd111900918c70fb5ee5e6e5002826cee0d3b2d3 (patch)
tree6cbcce75310a8030c8b837ac3ba898ccd3ab51b9 /bin/sh
parentfe59cb6ba2e50814f0bd9f187b8baebcb648e564 (diff)
downloadsrc-bd111900918c70fb5ee5e6e5002826cee0d3b2d3.tar.gz
src-bd111900918c70fb5ee5e6e5002826cee0d3b2d3.zip
sh: Do not ignore INTOFF during a trap
INTOFF postpones SIGINT processing and INTON enables it again. This is important so an interactive shell can return to the top level prompt when Ctrl+C is pressed. Given that INTON is automatically done when a builtin completes, the part where onsig() ignores suppressint when in_dotrap is true is both unnecessary and unsafe. If the trap is for some other signal than SIGINT, arbitrary code could have been interrupted. Historically, INTOFF remained in effect for longer. Reviewed by: bdrewery MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D25270
Notes
Notes: svn path=/head/; revision=363057
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/trap.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c
index b025a300208c..1b9ab63f47cb 100644
--- a/bin/sh/trap.c
+++ b/bin/sh/trap.c
@@ -382,12 +382,7 @@ onsig(int signo)
{
if (signo == SIGINT && trap[SIGINT] == NULL) {
- /*
- * The !in_dotrap here is safe. The only way we can arrive
- * here with in_dotrap set is that a trap handler set SIGINT to
- * SIG_DFL and killed itself.
- */
- if (suppressint && !in_dotrap)
+ if (suppressint)
SET_PENDING_INT;
else
onint();