summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-02-14 18:56:51 +0100
committerLennart Poettering <lennart@poettering.net>2011-02-14 18:56:55 +0100
commitf212ac125fb0f8dda6ed9ac50b0c315dd4f58974 (patch)
treeaf0d02e95604de169248a5806d2ba07a14f7b8b3 /src/util.c
parent7a57b332d0a0b229c1c24278840aebd19efe9ffe (diff)
getty: do not auto-spawn getty's on VC ttys if console=ttyN is used
https://bugzilla.redhat.com/show_bug.cgi?id=676885
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index e78063c5aa..d0c903993c 100644
--- a/src/util.c
+++ b/src/util.c
@@ -3549,6 +3549,16 @@ void filter_environ(const char *prefix) {
environ[j] = NULL;
}
+bool tty_is_vc(const char *tty) {
+ assert(tty);
+
+ if (startswith(tty, "/dev/"))
+ tty += 5;
+
+ return startswith(tty, "tty") &&
+ tty[3] >= '0' && tty[3] <= '9';
+}
+
const char *default_term_for_tty(const char *tty) {
char *active = NULL;
const char *term;
@@ -3566,9 +3576,7 @@ const char *default_term_for_tty(const char *tty) {
tty = active;
}
- term = (startswith(tty, "tty") &&
- tty[3] >= '0' && tty[3] <= '9') ? "TERM=linux" : "TERM=vt100";
-
+ term = tty_is_vc(tty) ? "TERM=linux" : "TERM=vt100";
free(active);
return term;