[gdm/rhel-7.9: 14/51] local-display-factory: try even harder to get to a login screen




commit 592428ed768af081a7309346ae1feb04fbde8ef7
Author: Ray Strode <rstrode redhat com>
Date:   Thu Oct 4 14:01:44 2018 -0400

    local-display-factory: try even harder to get to a login screen
    
    At the moment we sometimes fail to create a login screen when
    logout results in the user ending up on an empty VT.
    
    That is because we're accidentally running into the non-seat0
    code path for seat0.
    
    This commit addresses the problem by specifically checking for
    if the seat is multi-session capable rather than checking if
    the seat has an active session.

 daemon/gdm-local-display-factory.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 8b0b2e5c2..cf4f5095c 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -486,26 +486,29 @@ create_display (GdmLocalDisplayFactory *factory,
 {
         GdmDisplayStore *store;
         GdmDisplay      *display = NULL;
-        char            *active_session_id = NULL;
         int              ret;
 
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
 
-        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
-
-        if (ret == 0) {
+        if (sd_seat_can_multi_session (seat_id)) {
                 char *login_session_id = NULL;
 
                 /* If we already have a login window, switch to it */
                 if (get_login_window_session_id (seat_id, &login_session_id)) {
-                        if (g_strcmp0 (active_session_id, login_session_id) != 0) {
+                        char *active_session_id = NULL;
+
+                        ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
+
+                        if (ret == 0 && g_strcmp0 (active_session_id, login_session_id) != 0) {
                                 activate_session_id (factory, seat_id, login_session_id);
+
+                                g_clear_pointer (&login_session_id, g_free);
+                                g_clear_pointer (&active_session_id, g_free);
+                                return NULL;
                         }
+
                         g_clear_pointer (&login_session_id, g_free);
-                        g_clear_pointer (&active_session_id, g_free);
-                        return NULL;
                 }
-                g_clear_pointer (&active_session_id, g_free);
         } else {
                 /* Ensure we don't create the same display more than once */
                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);


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