Use "/dev/console" device node 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.pat...@pantacor.com>
Signed-off-by: Daniel Golle <dan...@makrotopia.org>
---
Instead of explaining the various remaining issues, I just went ahead
and fixed them myself.
v2:
 * Fix commit message (we are opening /dev/console which can also
   be a pty and not necessarily (5,1))
 * use tabs for indentation like in the rest of the file
 * don't use curly brackets for single statement conditional
 * use relative path when calling dev_exist()
 * use relative path when setting tty variable (as the result of

 inittab.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to