chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Resolve /dev/console to the active tty instead of just "tty0"
[elogind.git]
/
src
/
shared
/
util.c
diff --git
a/src/shared/util.c
b/src/shared/util.c
index 838885a464c3ae0964193e818cc38d005d992637..b77d010d2d5801a60da5e1492c5acadf6b2ae00b 100644
(file)
--- a/
src/shared/util.c
+++ b/
src/shared/util.c
@@
-3700,6
+3700,16
@@
char *resolve_dev_console(char **active) {
else
tty = *active;
+ if (streq(tty, "tty0")) {
+ char *tmp;
+
+ /* Get the active VC (e.g. tty1) */
+ if (read_one_line_file("/sys/class/tty/tty0/active", &tmp) >= 0) {
+ free(*active);
+ tty = *active = tmp;
+ }
+ }
+
return tty;
}