summaryrefslogtreecommitdiff
path: root/src/shutdown/shutdown.c
diff options
context:
space:
mode:
authorAnita Zhang <the.anitazha@gmail.com>2021-03-04 19:56:16 -0800
committerAnita Zhang <the.anitazha@gmail.com>2021-03-04 20:08:00 -0800
commitf975f1cc748929942188ae1490cf8480f8a64877 (patch)
tree6e1bf2aa8ea45b35bc602ec51a5c34d6c7eb86d7 /src/shutdown/shutdown.c
parentdbdcd51f78bde5e9033d98d61bbb750c868bde9d (diff)
downloadsystemd-f975f1cc748929942188ae1490cf8480f8a64877.tar.gz
shutdown: set always_reopen_console
Back in v232 systemd-shutdown would log to /dev/console. However after the addition of always_reopen_console (v233) it would log to STDERR. This caused some debugging issues as container systemd-shutdown logs weren't being logged to console as the arg `--log-target=console` suggested. Since it appears that always_reopen_console was intended for pid1, set it in systemd-shutdown as well so logs will go to /dev/console.
Diffstat (limited to 'src/shutdown/shutdown.c')
-rw-r--r--src/shutdown/shutdown.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/shutdown/shutdown.c b/src/shutdown/shutdown.c
index 0d07865542..c1fdc885af 100644
--- a/src/shutdown/shutdown.c
+++ b/src/shutdown/shutdown.c
@@ -322,6 +322,9 @@ int main(int argc, char *argv[]) {
log_set_prohibit_ipc(true);
log_parse_environment();
+ if (getpid_cached() == 1)
+ log_set_always_reopen_console(true);
+
r = parse_argv(argc, argv);
if (r < 0)
goto error;