]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sh: Do not ignore INTOFF during a trap
authorjilles <jilles@FreeBSD.org>
Thu, 9 Jul 2020 20:53:56 +0000 (20:53 +0000)
committerjilles <jilles@FreeBSD.org>
Thu, 9 Jul 2020 20:53:56 +0000 (20:53 +0000)
commit3019e6712dcb360c6a48435419a9b7a22372ba2a
tree6cbcce75310a8030c8b837ac3ba898ccd3ab51b9
parent64b063841d660c093a6bc1948faa7b4e8ebd5a9e
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
bin/sh/trap.c