]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Merge pull request #18886 from anitazha/shutdownconsole
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 31 Mar 2021 08:28:26 +0000 (10:28 +0200)
committerGitHub <noreply@github.com>
Wed, 31 Mar 2021 08:28:26 +0000 (10:28 +0200)
logging shutdown to /dev/console

1  2 
src/shutdown/shutdown.c

diff --combined src/shutdown/shutdown.c
index d2b162994c9fc9e605fb65cc2364851ee4c128d1,06b6618ff4c94cd176df81bec0ebba8b09ccbb54..29b24906a6fb52452255b78dcd33c771f929fa00
@@@ -322,6 -322,9 +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;
                          /* There are things we cannot get rid of. Loop one more time
                           * with LOG_ERR to inform the user. Note that we don't need
                           * to do this if there is a initrd to switch to, because that
 -                         * one is likely to get rid of the remounting mounts. If not,
 +                         * one is likely to get rid of the remaining mounts. If not,
                           * it will log about them. */
                          umount_log_level = LOG_ERR;
                          continue;
                  sync_with_progress();
  
          if (streq(arg_verb, "exit")) {
-                 if (in_container)
+                 if (in_container) {
+                         log_info("Exiting container.");
                          return arg_exit_code;
+                 }
  
                  cmd = RB_POWER_OFF; /* We cannot exit() on the host, fallback on another method. */
          }