chiark / gitweb /
cgroup: rename cg_update_unified() → cg_unified_update()
[elogind.git] / src / basic / log.c
index 0783372c5aa0cc738d50a8572ddedf8870b76c65..2c8e5738e845168f00a48b27b99009241bb23d7e 100644 (file)
@@ -74,6 +74,7 @@ static bool show_location = false;
 #if 0 /// UNNEEDED by elogind
 static bool upgrade_syslog_to_journal = false;
 #endif // 0
+static bool always_reopen_console = false;
 
 /* Akin to glibc's __abort_msg; which is private and we hence cannot
  * use here. */
@@ -97,7 +98,7 @@ static int log_open_console(void) {
         if (console_fd >= 0)
                 return 0;
 
-        if (getpid() == 1) {
+        if (always_reopen_console) {
                 console_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
                 if (console_fd < 0)
                         return console_fd;
@@ -1193,3 +1194,7 @@ int log_syntax_internal(
                         unit_fmt, unit,
                         NULL);
 }
+
+void log_set_always_reopen_console(bool b) {
+        always_reopen_console = b;
+}