[PATCH 2/2] systemd-logind: Only use systemd-logind integration together with keeptty

Hans de Goede hdegoede at redhat.com
Wed Jan 21 01:36:16 PST 2015


systemd-logind integration does not work when starting X on a new tty, as
that detaches X from the current session and after hat systemd-logind revokes
all rights any already open fds and refuses to open new fds for X.

This means that currently e.g. "startx -- vt7" breaks, and breaks badly,
requiring ssh access to the system to kill X.

The fix for this is easy, we must not use systemd-logind integration when
not using KeepTty, or iow we may only use systemd-logind integration together
with KeepTty.

Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 hw/xfree86/os-support/linux/systemd-logind.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index 49758f4..b061877 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -34,6 +34,7 @@
 
 #include "os.h"
 #include "dbus-core.h"
+#include "linux.h"
 #include "xf86.h"
 #include "xf86platformBus.h"
 #include "xf86Xinput.h"
@@ -595,6 +596,12 @@ static struct dbus_core_hook core_hook = {
 int
 systemd_logind_init(void)
 {
+    /* get vtno now as it may change keeptty */
+    linux_get_vtno();
+    /* systemd_logind integration requires keeptty */
+    if (!linux_get_keeptty())
+        return 1;
+
     return dbus_core_add_hook(&core_hook);
 }
 
-- 
2.1.0



More information about the xorg-devel mailing list