chiark / gitweb /
dbus: automatically send out changed events for properties written to
[elogind.git] / src / login / logind.c
index a54195cebb6d578ab343302090bad343630e6430..fc08c4bc69fc42d966761a5eaf5730dee4beed32 100644 (file)
@@ -6,16 +6,16 @@
   Copyright 2011 Lennart Poettering
 
   systemd is free software; you can redistribute it and/or modify it
-  under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
+  under the terms of the GNU Lesser General Public License as published by
+  the Free Software Foundation; either version 2.1 of the License, or
   (at your option) any later version.
 
   systemd is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-  General Public License for more details.
+  Lesser General Public License for more details.
 
-  You should have received a copy of the GNU General Public License
+  You should have received a copy of the GNU Lesser General Public License
   along with systemd; If not, see <http://www.gnu.org/licenses/>.
 ***/
 
@@ -945,14 +945,16 @@ static int manager_connect_console(Manager *m) {
         assert(m);
         assert(m->console_active_fd < 0);
 
+        /* On certain architectures (S390 and Xen, and containers),
+           /dev/tty0 does not exist, so don't fail if we can't open
+           it. */
+        if (access("/dev/tty0", F_OK) < 0) {
+                m->console_active_fd = -1;
+                return 0;
+        }
+
         m->console_active_fd = open("/sys/class/tty/tty0/active", O_RDONLY|O_NOCTTY|O_CLOEXEC);
         if (m->console_active_fd < 0) {
-
-                /* On certain architectures (S390 and Xen), /dev/tty0
-                   does not exist, so don't fail if we can't open it.*/
-                if (errno == ENOENT)
-                        return 0;
-
                 log_error("Failed to open /sys/class/tty/tty0/active: %m");
                 return -errno;
         }