util: properly resolve /dev/console if more than once console= argument was passed on the kernel command line

This commit is contained in:
Lennart Poettering 2011-02-14 19:54:15 +01:00
parent f212ac125f
commit 079a09fbf7

View file

@ -3573,7 +3573,13 @@ const char *default_term_for_tty(const char *tty) {
if (streq(tty, "console"))
if (read_one_line_file("/sys/class/tty/console/active", &active) >= 0) {
truncate_nl(active);
tty = active;
/* If multiple log outputs are configured the
* last one is what /dev/console points to */
if ((tty = strrchr(active, ' ')))
tty++;
else
tty = active;
}
term = tty_is_vc(tty) ? "TERM=linux" : "TERM=vt100";