summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbms <bms@FreeBSD.org>2006-08-02 12:42:20 +0000
committerbms <bms@FreeBSD.org>2006-08-02 12:42:20 +0000
commit03b3f7bd6fd196d5d4507b91179c00f60d3ed4c1 (patch)
tree6f4f761b3202148b01796ed3b902baa633b39f42
parent08d14c0219df6dd1caa98e1a4555eb10ac23d993 (diff)
downloadFreeBSD-src-03b3f7bd6fd196d5d4507b91179c00f60d3ed4c1.zip
FreeBSD-src-03b3f7bd6fd196d5d4507b91179c00f60d3ed4c1.tar.gz
Block SIGHUP before killing init(8), to avoid a race condition which may
kill the current process and hang the system when attempting reboot. PR: bin/64664 Reviewed by: ssouhal, phk (historic) MFC after: 30 days
-rw-r--r--sbin/reboot/reboot.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c
index 0a52ba4..29790b4 100644
--- a/sbin/reboot/reboot.c
+++ b/sbin/reboot/reboot.c
@@ -151,13 +151,13 @@ main(int argc, char *argv[])
if (!nflag)
sync();
+ /* Ignore the SIGHUP we get when our parent shell dies. */
+ (void)signal(SIGHUP, SIG_IGN);
+
/* Just stop init -- if we fail, we'll restart it. */
if (kill(1, SIGTSTP) == -1)
err(1, "SIGTSTP init");
- /* Ignore the SIGHUP we get when our parent shell dies. */
- (void)signal(SIGHUP, SIG_IGN);
-
/* Send a SIGTERM first, a chance to save the buffers. */
if (kill(-1, SIGTERM) == -1 && errno != ESRCH)
err(1, "SIGTERM processes");
OpenPOWER on IntegriCloud