From: Gaurav Pathak <gaurav.pathak@pantacor.com>
Date: Wed, 5 May 2021 11:32:45 +0000 (+0530)
Subject: procd: Use /dev/console for serial console if exists
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=021ece84de430fca988acd6934f6046ea59d8c37;p=project%2Fprocd.git

procd: Use /dev/console for serial console if exists

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>
---

diff --git a/inittab.c b/inittab.c
index 2c2270c..b2ffc9a 100644
--- 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, ',');