summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Untz <vuntz@gnome.org>2012-09-25 10:55:31 +0200
committerDavid Zeuthen <zeuthen@gmail.com>2012-09-25 10:30:33 -0400
commite07849db11c8f5cfdeaf2dd3bb9b430c99c376c7 (patch)
treed6424a2245e7457469a66e977c8aca1381ae06bd
parent1396be6c3f4d6aae6b38b469b1bd51fce46a829c (diff)
downloadudisks-e07849db11c8f5cfdeaf2dd3bb9b430c99c376c7.tar.gz
Fix same seat detection if built with systemd, but not booted with it
If we haven't booted with systemd, then we can only assume it's always the same seat. Based on patch by Takashi Iwai <tiwai@suse.com>. https://bugzilla.novell.com/show_bug.cgi?id=769570 https://bugs.freedesktop.org/show_bug.cgi?id=55309 Signed-off-by: David Zeuthen <zeuthen@gmail.com>
-rw-r--r--configure.ac2
-rw-r--r--src/udisksdaemonutil.c5
2 files changed, 6 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 994fd1a..93c715e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,7 +145,7 @@ AC_SUBST(LIBATASMART_CFLAGS)
AC_SUBST(LIBATASMART_LIBS)
PKG_CHECK_MODULES(LIBSYSTEMD_LOGIN,
- [libsystemd-login >= 44],
+ [libsystemd-login >= 44 libsystemd-daemon],
have_libsystemd_login=yes,
have_libsystemd_login=no)
AM_CONDITIONAL(HAVE_LIBSYSTEMD_LOGIN, test x$have_libsystemd_login = xyes)
diff --git a/src/udisksdaemonutil.c b/src/udisksdaemonutil.c
index ef925f5..69cd8a5 100644
--- a/src/udisksdaemonutil.c
+++ b/src/udisksdaemonutil.c
@@ -42,6 +42,7 @@
#include "udiskslinuxdriveobject.h"
#if defined(HAVE_LIBSYSTEMD_LOGIN)
+#include <systemd/sd-daemon.h>
#include <systemd/sd-login.h>
#endif
@@ -1021,6 +1022,10 @@ 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)
+ return TRUE;
+
if (UDISKS_IS_LINUX_BLOCK_OBJECT (object))
{
UDisksLinuxBlockObject *linux_block_object;