sysvinit-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] bootlogd: make isconsole() more lenient


From: Matthias Schiffer
Subject: [PATCH] bootlogd: make isconsole() more lenient
Date: Thu, 22 Jul 2021 14:18:44 +0200

Do not require a digit after the known prefix. This makes console
detection work with various serial drivers, which use device names like
ttymxc%d or ttyAPP%d.
---

An (even more lenient) alternative solution would be to try opening any
device passed as console=X as /dev/X as a last resort when all prefix
matches fail. Checking that the file is a chardev might make sense then?

The latter should also allow using console=null to disable the console
completely (which I consider a desirable feature, although it is
currently not working for the Linux kernel console either [1]).

Please let me know which solution you prefer, so I can update my patch
accordingly.


[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a91bd6223ecd46addc71ee6fcd432206d39365d2


 src/bootlogd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bootlogd.c b/src/bootlogd.c
index 787db87..5fb3939 100644
--- a/src/bootlogd.c
+++ b/src/bootlogd.c
@@ -228,7 +228,7 @@ int isconsole(char *s, char *res, int rlen)
                l = strlen(c->cmdline);
                if (sl <= l) continue;
                p = s + l;
-               if (strncmp(s, c->cmdline, l) != 0 || !isdigit(*p))
+               if (strncmp(s, c->cmdline, l) != 0)
                        continue;
                for (i = 0; i < 2; i++) {
                        snprintf(res, rlen, i ? c->dev1 : c->dev2, p);
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]