170140
From 266bae418f6f55e0061b089c5bbfdeac2598f155 Mon Sep 17 00:00:00 2001
170140
From: Martin Pitt <martinpitt@gnome.org>
170140
Date: Thu, 21 Mar 2013 06:23:59 +0000
170140
Subject: Fix test for logind availability
170140
170140
sd_booted() is not an appropriate check for whether we should talk to logind,
170140
test for /run/systemd/seats/ instead.
170140
170140
For details, see:
170140
<https://mail.gnome.org/archives/desktop-devel-list/2013-March/msg00092.html>
170140
---
170140
diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c
170140
index 4c23906..fb50a0f 100644
170140
--- a/src/udisksdaemonutil.c
170140
+++ b/src/udisksdaemonutil.c
170140
@@ -44,6 +44,8 @@
170140
 #if defined(HAVE_LIBSYSTEMD_LOGIN)
170140
 #include <systemd/sd-daemon.h>
170140
 #include <systemd/sd-login.h>
170140
+
170140
+#define LOGIND_AVAILABLE() (access("/run/systemd/seats/", F_OK) >= 0)
170140
 #endif
170140
 
170140
 /**
170140
@@ -1039,8 +1041,8 @@ udisks_daemon_util_on_same_seat (UDisksDaemon          *daemon,
170140
   UDisksObject *drive_object = NULL;
170140
   UDisksDrive *drive = NULL;
170140
 
170140
-  /* if we haven't booted with systemd, assume it's always the same seat */
170140
-  if (sd_booted () <= 0)
170140
+  /* if we don't have logind, assume it's always the same seat */
170140
+  if (!LOGIND_AVAILABLE())
170140
     return TRUE;
170140
 
170140
   if (UDISKS_IS_LINUX_BLOCK_OBJECT (object))
170140
--
170140
cgit v0.9.0.2-2-gbebe