summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--rvnit.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/rvnit.c b/rvnit.c
index d8fcd56..75b55d5 100644
--- a/rvnit.c
+++ b/rvnit.c
@@ -716,6 +716,14 @@ main(int argc, char *argv[])
 	if (pid1)
 		ioctl(0, TIOCNOTTY);
 
+	sigset_t emptyset;
+	sigemptyset(&emptyset);
+	sigaction(SIGINT,
+	    &(struct sigaction){ .sa_handler=on_sigint, .sa_mask=emptyset }, 0);
+
+#ifdef __linux__
+	reboot(RB_DISABLE_CAD);
+#endif
 
 	int i;
 	for (level = 0; level < 100; level++) {
@@ -800,10 +808,6 @@ cont1:
 		}
 	}
 
-	sigset_t emptyset;
-	sigemptyset(&emptyset);
-	sigaction(SIGINT,
-	    &(struct sigaction){ .sa_handler=on_sigint, .sa_mask=emptyset }, 0);
 	sigaction(SIGCONT,
 	    &(struct sigaction){ .sa_handler=on_sigcont, .sa_mask=emptyset }, 0);
 
@@ -895,6 +899,10 @@ cont2:
 	if (pid1)
 		own_console();
 
+#ifdef __linux__
+	reboot(RB_ENABLE_CAD);
+#endif
+
 	LOG("shutting down");
 
 	if (want_reboot) {