[gdm/rhel-7.9: 10/51] manager: don't bail if session disappears out from under us




commit 287345198db5ae88b1bd30dc5bfd7a4b15ed193a
Author: Ray Strode <rstrode redhat com>
Date:   Fri Jun 22 15:26:03 2018 -0400

    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.

 daemon/gdm-manager.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 3f5772e65..afc89c19f 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1345,6 +1345,10 @@ get_login_window_session_id (const char  *seat_id,
 
                 res = sd_session_get_class (sessions[i], &service_class);
                 if (res < 0) {
+                        if (res == -ENOENT || res == -ENXIO) {
+                                continue;
+                        }
+
                         g_debug ("failed to determine class of session %s: %s", sessions[i], strerror 
(-res));
                         ret = FALSE;
                         goto out;
@@ -1359,6 +1363,9 @@ get_login_window_session_id (const char  *seat_id,
 
                 ret = sd_session_get_state (sessions[i], &state);
                 if (ret < 0) {
+                        if (res == -ENOENT || res == -ENXIO)
+                                continue;
+
                         g_debug ("failed to determine state of session %s: %s", sessions[i], strerror 
(-res));
                         ret = FALSE;
                         goto out;
@@ -1372,6 +1379,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 || res == -ENXIO)
+                                continue;
                         g_debug ("failed to determine service of session %s: %s", sessions[i], strerror 
(-res));
                         ret = FALSE;
                         goto out;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]