summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pitt <martinpitt@gnome.org>2013-03-21 07:23:59 +0100
committerMartin Pitt <martinpitt@gnome.org>2013-03-21 07:27:42 +0100
commit266bae418f6f55e0061b089c5bbfdeac2598f155 (patch)
treee116a6f2e7fb05147c8d60fcfcbbd0a390fdc7bb
parentb841e30a98459816dfc49a735d3db4355a88edcd (diff)
Fix test for logind availability
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>
-rw-r--r--src/udisksdaemonutil.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c
index 4c23906..fb50a0f 100644
--- a/src/udisksdaemonutil.c
+++ b/src/udisksdaemonutil.c
@@ -44,6 +44,8 @@
#if defined(HAVE_LIBSYSTEMD_LOGIN)
#include <systemd/sd-daemon.h>
#include <systemd/sd-login.h>
+
+#define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0)
#endif
/**
@@ -1039,8 +1041,8 @@ udisks_daemon_util_on_same_seat (UDisksDaemon *daemon,
UDisksObject *drive_object = NULL;
UDisksDrive *drive = NULL;
- /* if we haven't booted with systemd, assume it's always the same seat */
- if (sd_booted () <= 0)
+ /* if we don't have logind, assume it's always the same seat */
+ if (!LOGIND_AVAILABLE())
return TRUE;
if (UDISKS_IS_LINUX_BLOCK_OBJECT (object))