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>

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=62585
[trivial whitespace fix -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
Martin Pitt 2013-03-21 09:24:21 +01:00 committed by Simon McVittie
parent 15b2d2bb25
commit e25938d527

View 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;