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

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