[PATCH] logind: do not abort if /dev/tty0 doesn't exist

Frederic Crozat fcrozat at suse.com
Mon Dec 19 08:17:09 PST 2011


Xen or S/390 might not have /dev/tty0, logind should cope with it.
---
 src/login/logind.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/login/logind.c b/src/login/logind.c
index 4633a5e..f491cee 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -906,6 +906,8 @@ 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) {
+                if (errno == ENOENT)
+                         return 0;
                 log_error("Failed to open /sys/class/tty/tty0/active: %m");
                 return -errno;
         }
-- 
1.7.7


--=-xu0592M3/zYoPvskKx4/--



More information about the systemd-devel mailing list