When resolving /dev/console one would often get "tty0" meaning the active VT.
Resolving to the actual tty (e.g. "tty1") will notably help on boot when
determining whether or not PID1 can output to the console.
---
 src/shared/util.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/shared/util.c b/src/shared/util.c
index 9a075fa..391bc1d 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -3621,6 +3621,16 @@ char *resolve_dev_console(char **active) {
         else
                 tty = *active;
 
+        if (streq(tty, "tty0")) {
+                free(*active);
+
+                /* Get the active VC (e.g. tty1) */
+                if (read_one_line_file("/sys/class/tty/tty0/active", active) < 
0)
+                        *active = strdup("tty0");
+
+                tty = *active;
+        }
+
         return tty;
 }
 
-- 
1.8.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to