Blame SOURCES/0007-local-display-factory-try-even-harder-to-get-to-a-lo.patch

ca70cf
From 72782991144e8e6671c2dbed6fe1727e2dc329fb Mon Sep 17 00:00:00 2001
ca70cf
From: Ray Strode <rstrode@redhat.com>
ca70cf
Date: Thu, 4 Oct 2018 14:01:44 -0400
ca70cf
Subject: [PATCH 7/7] local-display-factory: try even harder to get to a login
ca70cf
 screen
ca70cf
ca70cf
At the moment we sometimes fail to create a login screen when
ca70cf
logout results in the user ending up on an empty VT.
ca70cf
ca70cf
That is because we're accidentally running into the non-seat0
ca70cf
code path for seat0.
ca70cf
ca70cf
This commit addresses the problem by specifically checking for
ca70cf
if the seat is multi-session capable rather than checking if
ca70cf
the seat has an active session.
ca70cf
---
ca70cf
 daemon/gdm-local-display-factory.c | 19 +++++++++++--------
ca70cf
 1 file changed, 11 insertions(+), 8 deletions(-)
ca70cf
ca70cf
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
ca70cf
index 8b0b2e5c2..cf4f5095c 100644
ca70cf
--- a/daemon/gdm-local-display-factory.c
ca70cf
+++ b/daemon/gdm-local-display-factory.c
ca70cf
@@ -459,80 +459,83 @@ get_login_window_session_id (const char  *seat_id,
ca70cf
                         free (service_id);
ca70cf
                         goto out;
ca70cf
                 }
ca70cf
 
ca70cf
                 free (service_id);
ca70cf
         }
ca70cf
 
ca70cf
         *session_id = NULL;
ca70cf
         ret = FALSE;
ca70cf
 
ca70cf
 out:
ca70cf
         if (sessions) {
ca70cf
                 for (i = 0; sessions[i]; i ++) {
ca70cf
                         free (sessions[i]);
ca70cf
                 }
ca70cf
 
ca70cf
                 free (sessions);
ca70cf
         }
ca70cf
 
ca70cf
         return ret;
ca70cf
 }
ca70cf
 
ca70cf
 static GdmDisplay *
ca70cf
 create_display (GdmLocalDisplayFactory *factory,
ca70cf
                 const char             *seat_id,
ca70cf
                 const char             *session_type,
ca70cf
                 gboolean                initial)
ca70cf
 {
ca70cf
         GdmDisplayStore *store;
ca70cf
         GdmDisplay      *display = NULL;
ca70cf
-        char            *active_session_id = NULL;
ca70cf
         int              ret;
ca70cf
 
ca70cf
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
ca70cf
 
ca70cf
-        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
ca70cf
-
ca70cf
-        if (ret == 0) {
ca70cf
+        if (sd_seat_can_multi_session (seat_id)) {
ca70cf
                 char *login_session_id = NULL;
ca70cf
 
ca70cf
                 /* If we already have a login window, switch to it */
ca70cf
                 if (get_login_window_session_id (seat_id, &login_session_id)) {
ca70cf
-                        if (g_strcmp0 (active_session_id, login_session_id) != 0) {
ca70cf
+                        char *active_session_id = NULL;
ca70cf
+
ca70cf
+                        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
ca70cf
+
ca70cf
+                        if (ret == 0 && g_strcmp0 (active_session_id, login_session_id) != 0) {
ca70cf
                                 activate_session_id (factory, seat_id, login_session_id);
ca70cf
+
ca70cf
+                                g_clear_pointer (&login_session_id, g_free);
ca70cf
+                                g_clear_pointer (&active_session_id, g_free);
ca70cf
+                                return NULL;
ca70cf
                         }
ca70cf
+
ca70cf
                         g_clear_pointer (&login_session_id, g_free);
ca70cf
-                        g_clear_pointer (&active_session_id, g_free);
ca70cf
-                        return NULL;
ca70cf
                 }
ca70cf
-                g_clear_pointer (&active_session_id, g_free);
ca70cf
         } else {
ca70cf
                 /* Ensure we don't create the same display more than once */
ca70cf
                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
ca70cf
 
ca70cf
                 if (display != NULL) {
ca70cf
                         return NULL;
ca70cf
                 }
ca70cf
         }
ca70cf
 
ca70cf
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
ca70cf
 
ca70cf
 #ifdef ENABLE_USER_DISPLAY_SERVER
ca70cf
         if (g_strcmp0 (seat_id, "seat0") == 0) {
ca70cf
                 display = gdm_local_display_new ();
ca70cf
                 if (session_type != NULL) {
ca70cf
                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
ca70cf
                 }
ca70cf
         }
ca70cf
 #endif
ca70cf
 
ca70cf
         if (display == NULL) {
ca70cf
                 guint32 num;
ca70cf
 
ca70cf
                 num = take_next_display_number (factory);
ca70cf
 
ca70cf
                 display = gdm_legacy_display_new (num);
ca70cf
         }
ca70cf
 
ca70cf
         g_object_set (display, "seat-id", seat_id, NULL);
ca70cf
         g_object_set (display, "is-initial", initial, NULL);
ca70cf
-- 
ca70cf
2.17.1
ca70cf