summary refs log tree commit diff
path: root/rvnit.c
diff options
context:
space:
mode:
Diffstat (limited to 'rvnit.c')
-rw-r--r--rvnit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/rvnit.c b/rvnit.c
index f49fdd3..ed6abd2 100644
--- a/rvnit.c
+++ b/rvnit.c
@@ -1050,4 +1050,18 @@ cont4:
 
 	close(selflogfd[1]);
 	pthread_join(logger_thread, 0);
+
+#ifdef __linux__
+	if (pid1) {
+		sync();
+		if (want_reboot) {
+			reboot(RB_AUTOBOOT);
+		} else {
+			// falls back to RB_HALT_SYSTEM if not possible
+			reboot(RB_POWER_OFF);
+		}
+	}
+#endif
+
+	return 0;
 }