]> code.delx.au - pulseaudio/commitdiff
console-kit, systemd-login: Check for logind, not for systemd
authorMartin Pitt <martinpitt@gnome.org>
Thu, 21 Mar 2013 13:17:33 +0000 (14:17 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 29 Mar 2013 11:33:18 +0000 (13:33 +0200)
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:
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html

Drop the now unnecessary linking against libsystemd-daemon, and stop linking
the consolekit module to any systemd library.

https://bugs.freedesktop.org/show_bug.cgi?id=62593

configure.ac
src/Makefile.am
src/modules/module-console-kit.c
src/modules/module-systemd-login.c

index 8a02cb7da17c647ec1655bc9e72ef63c63986a66..43d3b44d53f3a32c0256c3ba6dcb831faa77399d 100644 (file)
@@ -1163,7 +1163,7 @@ AC_ARG_ENABLE([systemd],
     AS_HELP_STRING([--disable-systemd],[Disable optional systemd support]))
 
 AS_IF([test "x$enable_systemd" != "xno"],
-    [PKG_CHECK_MODULES(SYSTEMD, [ libsystemd-login libsystemd-daemon ], HAVE_SYSTEMD=1, HAVE_SYSTEMD=0)],
+    [PKG_CHECK_MODULES(SYSTEMD, [ libsystemd-login ], HAVE_SYSTEMD=1, HAVE_SYSTEMD=0)],
     HAVE_SYSTEMD=0)
 
 AS_IF([test "x$enable_systemd" = "xyes" && test "x$HAVE_SYSTEMD" = "x0"],
index 559c43eef92220bd83241943c2b6acbb161bfbe8..4b3efa37ef5f4649922a6cb484406f52341712d4 100644 (file)
@@ -1971,8 +1971,8 @@ module_udev_detect_la_CFLAGS = $(AM_CFLAGS) $(UDEV_CFLAGS)
 
 module_console_kit_la_SOURCES = modules/module-console-kit.c
 module_console_kit_la_LDFLAGS = $(MODULE_LDFLAGS)
-module_console_kit_la_LIBADD = $(MODULE_LIBADD) $(DBUS_LIBS) $(SYSTEMD_LIBS)
-module_console_kit_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(SYSTEMD_CFLAGS)
+module_console_kit_la_LIBADD = $(MODULE_LIBADD) $(DBUS_LIBS)
+module_console_kit_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS)
 
 module_systemd_login_la_SOURCES = modules/module-systemd-login.c
 module_systemd_login_la_LDFLAGS = $(MODULE_LDFLAGS)
index c9c2f4536f77e4ace79bfe123a503531959f9ff8..af1e02b0b0bed6591b108be8d1f2e9247f0717e8 100644 (file)
 #include <stdlib.h>
 #include <sys/types.h>
 
-#ifdef HAVE_SYSTEMD
-#include <systemd/sd-login.h>
-#include <systemd/sd-daemon.h>
-#endif
-
 #include <pulse/xmalloc.h>
 
 #include <pulsecore/module.h>
@@ -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");
index 8ad836e46ae1e25b64abb2151e7a6191f92663ce..cc8b4625857e712231ad9138fa1f88e4b543c148 100644 (file)
@@ -31,7 +31,6 @@
 #include <sys/types.h>
 
 #include <systemd/sd-login.h>
-#include <systemd/sd-daemon.h>
 
 #include <pulse/xmalloc.h>
 
@@ -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);