summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--daemon/gdm-slave.c19
2 files changed, 19 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index b747e7ae..b70f5372 100644
--- a/configure.ac
+++ b/configure.ac
@@ -928,7 +928,7 @@ dnl - Check for systemd support
dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(SYSTEMD,
- [libsystemd-login libsystemd-daemon],
+ [libsystemd-login >= 186 libsystemd-daemon],
[have_systemd=yes], [have_systemd=no])
if test "x$with_systemd" = "xauto" ; then
diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c
index 53633c0d..8634ee8a 100644
--- a/daemon/gdm-slave.c
+++ b/daemon/gdm-slave.c
@@ -1417,6 +1417,8 @@ gdm_slave_get_primary_session_id_for_user_from_systemd (GdmSlave *slave,
for (i = 0; sessions[i] != NULL; i++) {
char *type;
+ char *state;
+ gboolean is_closing;
gboolean is_active;
gboolean is_x11;
uid_t other;
@@ -1441,7 +1443,22 @@ gdm_slave_get_primary_session_id_for_user_from_systemd (GdmSlave *slave,
/* Always give preference to non-active sessions,
* so we migrate when we can and don't when we can't
*/
- is_active = sd_session_is_active (sessions[i]) > 0;
+ res = sd_session_get_state (sessions[i], &state);
+ if (res < 0) {
+ g_warning ("GdmSlave: could not fetch state of session '%s': %s",
+ sessions[i], strerror (-res));
+ continue;
+ }
+
+ is_closing = g_strcmp0 (state, "closing") == 0;
+ is_active = g_strcmp0 (state, "active") == 0;
+ free (state);
+
+ /* Ignore closing sessions
+ */
+ if (is_closing) {
+ continue;
+ }
res = sd_session_get_uid (sessions[i], &other);
if (res == 0 && other == uid && !got_primary_ssid) {