diff options
author | Ray Strode <rstrode@redhat.com> | 2018-06-22 15:26:03 -0400 |
---|---|---|
committer | Ray Strode <rstrode@redhat.com> | 2018-06-22 16:09:48 -0400 |
commit | 155ee7eca48888c6ac15cf8e6cd2bfce6f1db1ad (patch) | |
tree | 5d0629f8cb886434f9de2e5515f9f93cc499e7a3 | |
parent | 9b65b9331089db6aaaf8df222eb87b6ef8241838 (diff) | |
download | gdm-155ee7eca48888c6ac15cf8e6cd2bfce6f1db1ad.tar.gz |
manager: don't bail if session disappears out from under us
It's entirely possible for a session returned by
sd_seat_get_sessions to disappear immediately after the
sd_seat_get_sessions call returns. This is especially
likely at logout time where the session will briefly be
in the "closing" state before getting reaped.
If that happens when we're looking for a greeter session, we
stop looking for a greeter session and bail out all confused.
This commit fixes the confusion by gracefully handling the
session disappearing by just proceeding to the next session
in the list.
-rw-r--r-- | daemon/gdm-manager.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c index c3cbabd8..1370bab4 100644 --- a/daemon/gdm-manager.c +++ b/daemon/gdm-manager.c @@ -1345,6 +1345,11 @@ get_login_window_session_id (const char *seat_id, res = sd_session_get_class (sessions[i], &service_class); if (res < 0) { + if (res == -ENOENT) { + free (service_class); + continue; + } + g_debug ("failed to determine class of session %s: %s", sessions[i], strerror (-res)); ret = FALSE; goto out; @@ -1359,6 +1364,9 @@ get_login_window_session_id (const char *seat_id, ret = sd_session_get_state (sessions[i], &state); if (ret < 0) { + if (res == -ENOENT) + continue; + g_debug ("failed to determine state of session %s: %s", sessions[i], strerror (-res)); ret = FALSE; goto out; @@ -1372,6 +1380,8 @@ get_login_window_session_id (const char *seat_id, res = sd_session_get_service (sessions[i], &service_id); if (res < 0) { + if (res == -ENOENT) + continue; g_debug ("failed to determine service of session %s: %s", sessions[i], strerror (-res)); ret = FALSE; goto out; |