Fix test for logind availability
authorMartin Pitt <martinpitt@gnome.org>
Thu, 21 Mar 2013 08:24:21 +0000 (09:24 +0100)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 25 Mar 2013 13:57:57 +0000 (13:57 +0000)
sd_booted() is not an appropriate check for whether we should talk to logind,
test for /run/systemd/seats/ instead.

For details, see:
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
[trivial whitespace fix -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
dbus/dbus-userdb-util.c

index 16bf229..5af0092 100644 (file)
@@ -21,6 +21,7 @@
  *
  */
 #include <config.h>
+#include <unistd.h>
 #define DBUS_USERDB_INCLUDES_PRIVATE 1
 #include "dbus-userdb.h"
 #include "dbus-test.h"
@@ -29,7 +30,6 @@
 #include <string.h>
 
 #if HAVE_SYSTEMD
-#include <systemd/sd-daemon.h>
 #include <systemd/sd-login.h>
 #endif
 
@@ -55,7 +55,8 @@ _dbus_is_console_user (dbus_uid_t uid,
   dbus_bool_t result = FALSE;
 
 #ifdef HAVE_SYSTEMD
-  if (sd_booted () > 0)
+  /* check if we have logind */
+  if (access ("/run/systemd/seats/", F_OK) >= 0)
     {
       int r;