Fix #320: close API/IPC socket immediately in shutdown/reboot

This protects against any hook scripts or services calling initctl when
we're going down.  There's no way to service these requests anyway, so
no point in keeping the socket open.  This way initctl can check for
the existence of the socket before attempting any IPC command.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2022-11-22 08:10:49 +01:00
parent 1a439baf68
commit 457c0a246f
2 changed files with 2 additions and 2 deletions
+1 -2
View File
@@ -318,9 +318,8 @@ void do_shutdown(shutop_t op)
do_iterate_proc(kill_cb, &signo);
}
/* Exit plugins and API gracefully */
/* Exit plugins gracefully */
plugin_exit();
api_exit();
/* We can no longer act on conditions, activate script runner */
cond_exit();
+1
View File
@@ -150,6 +150,7 @@ restart:
/* Restore terse mode and run hooks before shutdown */
if (runlevel == 0 || runlevel == 6) {
api_exit();
log_exit();
plugin_run_hooks(HOOK_SHUTDOWN);
}