projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
51d0f1c
)
Resolve /dev/console to the active tty instead of just "tty0"
author
Olivier Brunel
<jjk@jjacky.com>
Fri, 20 Sep 2013 20:18:28 +0000
(22:18 +0200)
committer
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Thu, 14 Nov 2013 04:22:30 +0000
(23:22 -0500)
When resolving /dev/console one would often get "tty0" meaning the active VT.
Resolving to the actual tty (e.g. "tty1") will notably help on boot when
determining whether or not PID1 can output to the console.
src/shared/util.c
patch
|
blob
|
history
diff --git
a/src/shared/util.c
b/src/shared/util.c
index
838885a
..
b77d010
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;
}