summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2012-06-15 22:22:24 +0200
committerMichal Schmidt <mschmidt@redhat.com>2012-06-15 22:34:34 +0200
commitcdc564d27f71f82457e96e9b237564fc6e8e84c9 (patch)
treec9f5e954c693574c46191244054acaa233c24fa8
parent98709151f3e782eb508ba15e2a12c0b46003f061 (diff)
logind: more robust handling of VT-less systems
Restore the check that was removed in commit 74afee9c. Its removal caused a regression on some s390x systems where for whatever reason the device node /dev/tty0 exists and makes the preceding access() check pass.
-rw-r--r--src/login/logind.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/login/logind.c b/src/login/logind.c
index 62f7914fec..1eb745adce 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1244,6 +1244,12 @@ static int manager_connect_console(Manager *m) {
m->console_active_fd = open("/sys/class/tty/tty0/active", O_RDONLY|O_NOCTTY|O_CLOEXEC);
if (m->console_active_fd < 0) {
+
+ /* On some systems the device node /dev/tty0 may exist
+ * even though /sys/class/tty/tty0 does not. */
+ if (errno == ENOENT)
+ return 0;
+
log_error("Failed to open /sys/class/tty/tty0/active: %m");
return -errno;
}