procd: Use /dev/console for serial console if exists
authorGaurav Pathak <gaurav.pathak@pantacor.com>
Wed, 5 May 2021 11:32:45 +0000 (17:02 +0530)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 5 May 2021 12:11:53 +0000 (13:11 +0100)
inittab.c: Use "/dev/console" if it is present, before trying
"/sys/class/tty/console/active" in case if console kernel command
line is not provided during boot and to allow container environment
to use it as login PTY console.

Signed-off-by: Gaurav Pathak <gaurav.pathak@pantacor.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
inittab.c

index 2c2270cf68d367bcb882e0467d2bfd2456111daa..b2ffc9a25e5fc69aa6a581002331c3ab93c1cc3f 100644 (file)
--- a/inittab.c
+++ b/inittab.c
@@ -190,7 +190,10 @@ static void askconsole(struct init_action *a)
         */
        tty = get_cmdline_val("console", line, sizeof(line));
        if (tty == NULL) {
-               tty = get_active_console(line, sizeof(line));
+               if (dev_exist("console"))
+                       tty = "console";
+               else
+                       tty = get_active_console(line, sizeof(line));
        }
        if (tty != NULL) {
                split = strchr(tty, ',');