[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/logind.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/logind.c b/src/logind.c
index 4633a5e..f491cee 100644
--- a/src/logind.c
+++ b/src/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


--=-li1Spmi25rWB7XEWSHrB--



More information about the systemd-devel mailing list