oneit appears to have made the assumption that /sys/class/tty/console/active provides a list of console names separated by newline characters. It turned out, though, that individual names are separated by space characters with a newline character at the very end of the list.
We previously observed the following error message: oneit: /dev/ttynull ttyS0: No such file or directory --- toys/other/oneit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/toys/other/oneit.c b/toys/other/oneit.c index d154f582..13f58078 100644 --- a/toys/other/oneit.c +++ b/toys/other/oneit.c @@ -73,12 +73,13 @@ void oneit_main(void) // Autodetect console from sysfs if no -c memcpy(toybuf, "/dev/", 5); if (!TT.c && (TT.c = readfile("/sys/class/tty/console/active", ss, 4096))) { - // Remove null terminator, take last entry + // Take last entry, remove newline terminator for (;;) { - if (!(ss = strchr(TT.c, '\n'))) break; + if (!(ss = strchr(TT.c, ' '))) break; if (!ss[1]) *ss = 0; else TT.c = ++ss; } + if (ss = strchr(TT.c, '\n')) ss[1] = 0; // Ensure /dev prefix strstart(&TT.c, "/dev/"); memmove(toybuf+5, TT.c, strlen(TT.c)); -- 2.40.0.634.g4ca3ef3211-goog _______________________________________________ Toybox mailing list Toybox@lists.landley.net http://lists.landley.net/listinfo.cgi/toybox-landley.net