summaryrefslogtreecommitdiffstats
path: root/bin/sh/error.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2014-12-21 23:09:59 +0000
committerjilles <jilles@FreeBSD.org>2014-12-21 23:09:59 +0000
commit69642127b499da2a10ddacccdef93a5ec591f2da (patch)
treedab5b3d86b3e1183dd29aed48130efe830dbc6ec /bin/sh/error.c
parentffe29740d4971390457d911c48e446936d72eccb (diff)
downloadFreeBSD-src-69642127b499da2a10ddacccdef93a5ec591f2da.zip
FreeBSD-src-69642127b499da2a10ddacccdef93a5ec591f2da.tar.gz
sh: Move some code from onint() to onsig(), making onint() noreturn.
As a result, the INTON macro which is used many times generates fewer bytes of code.
Diffstat (limited to 'bin/sh/error.c')
-rw-r--r--bin/sh/error.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/bin/sh/error.c b/bin/sh/error.c
index 96a0092..fedffaa 100644
--- a/bin/sh/error.c
+++ b/bin/sh/error.c
@@ -90,13 +90,14 @@ exraise(int e)
/*
- * Called from trap.c when a SIGINT is received. (If the user specifies
- * that SIGINT is to be trapped or ignored using the trap builtin, then
- * this routine is not called.) Suppressint is nonzero when interrupts
- * are held using the INTOFF macro. If SIGINTs are not suppressed and
- * the shell is not a root shell, then we want to be terminated if we
- * get here, as if we were terminated directly by a SIGINT. Arrange for
- * this here.
+ * Called from trap.c when a SIGINT is received and not suppressed, or when
+ * an interrupt is pending and interrupts are re-enabled using INTON.
+ * (If the user specifies that SIGINT is to be trapped or ignored using the
+ * trap builtin, then this routine is not called.) Suppressint is nonzero
+ * when interrupts are held using the INTOFF macro. If SIGINTs are not
+ * suppressed and the shell is not a root shell, then we want to be
+ * terminated if we get here, as if we were terminated directly by a SIGINT.
+ * Arrange for this here.
*/
void
@@ -104,16 +105,6 @@ onint(void)
{
sigset_t sigs;
- /*
- * 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) {
- intpending++;
- return;
- }
intpending = 0;
sigemptyset(&sigs);
sigprocmask(SIG_SETMASK, &sigs, NULL);
@@ -130,6 +121,7 @@ onint(void)
else {
signal(SIGINT, SIG_DFL);
kill(getpid(), SIGINT);
+ _exit(128 + SIGINT);
}
}
OpenPOWER on IntegriCloud