Disable login also in shutdown/reboot

Disable login in single-user mode as well as shutdown/reboot

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-08-24 19:27:23 +02:00
parent 62cb683af0
commit a9a7b08021
+6 -5
View File
@@ -154,6 +154,12 @@ restart:
/* Cleanup stale services */
svc_clean_dynamic(service_unregister);
/* Disable login in single-user mode as well as shutdown/reboot */
if (runlevel == 1 || runlevel == 0 || runlevel == 6)
touch("/etc/nologin");
else
erase("/etc/nologin");
if (0 == runlevel) {
do_shutdown(SHUT_OFF);
sm->state = SM_RUNNING_STATE;
@@ -165,11 +171,6 @@ restart:
break;
}
if (runlevel == 1)
touch("/etc/nologin"); /* Disable login in single-user mode */
else
erase("/etc/nologin");
/* No TTYs run at bootstrap, they have a delayed start. */
if (prevlevel > 0)
tty_runlevel(runlevel);