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

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