From 70ffc17f9d17ab587d7608ef2c491948747ffd21 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Thu, 21 Mar 2013 14:17:33 +0100 Subject: [PATCH] consolekit, systemd: Check for logind, not for systemd It is possible to build systemd without logind, in which case sd_booted() wo succeed. Check for /run/systemd/seats to test for logind instead, as recommended by systemd upstream. For details, see: #include -#ifdef HAVE_SYSTEMD -#include -#include -#endif - #include #include @@ -285,12 +280,10 @@ int pa__init(pa_module*m) { dbus_error_init(&error); -#ifdef HAVE_SYSTEMD - /* If systemd support is enabled and we boot on systemd we - shouldn't watch ConsoleKit but systemd's logind service. */ - if (sd_booted() > 0) + /* If systemd's logind service is running, we shouldn't watch ConsoleKit + * but login */ + if (access("/run/systemd/seats/", F_OK) >= 0) return 0; -#endif if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { pa_log("Failed to parse module arguments"); diff --git a/src/modules/module-systemd-login.c b/src/modules/module-systemd-login.c index 8ad836e..cc8b462 100644 --- a/src/modules/module-systemd-login.c +++ b/src/modules/module-systemd-login.c @@ -31,7 +31,6 @@ #include #include -#include #include @@ -169,8 +168,8 @@ int pa__init(pa_module *m) { pa_assert(m); - /* If we are not actually booting with systemd become a NOP */ - if (sd_booted() <= 0) + /* If we are not actually running logind become a NOP */ + if (access("/run/systemd/seats/", F_OK) < 0) return 0; ma = pa_modargs_new(m->argument, valid_modargs); -- 1.8.1.2