[gdm/wip/vt-fix] session-worker: don't take control of a vt just because we're changing to it



commit 09a52e0f050809582c824a182407979e7237774c
Author: Ray Strode <rstrode redhat com>
Date:   Fri Aug 2 10:53:37 2019 -0400

    session-worker: don't take control of a vt just because we're changing to it
    
    The session worker should only take control of VTs it's actually managing.
    
    Right now, if a session worker jumps back to the login screen during tear
    down, it takes control of the login screen's VT and then exits
    
    That leaves the VT in kernel control until the next login which is not
    ideal.
    
    This commit fixes that.

 daemon/gdm-session-worker.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
index cc565a4c..aa824bcf 100644
--- a/daemon/gdm-session-worker.c
+++ b/daemon/gdm-session-worker.c
@@ -664,7 +664,7 @@ gdm_session_worker_process_pam_message (GdmSessionWorker          *worker,
         char    *user_answer;
         gboolean res;
         char    *utf8_msg;
-        char   *msg;
+        char        *msg;
 
         if (response != NULL) {
                 *response = NULL;
@@ -954,7 +954,8 @@ out:
 
 static void
 jump_to_vt (GdmSessionWorker  *worker,
-            int                vt_number)
+            int                vt_number,
+            gboolean           take_control)
 {
         int fd;
         int active_vt_tty_fd;
@@ -990,7 +991,8 @@ jump_to_vt (GdmSessionWorker  *worker,
                 fd = active_vt_tty_fd;
         }
 
-        handle_terminal_vt_switches (worker, fd);
+        if (take_control)
+                handle_terminal_vt_switches (worker, fd);
 
         if (ioctl (fd, VT_GETSTATE, &vt_state) < 0) {
                 g_debug ("GdmSessionWorker: couldn't get current VT: %m");
@@ -1053,7 +1055,7 @@ gdm_session_worker_uninitialize_pam (GdmSessionWorker *worker,
 
         if (g_strcmp0 (worker->priv->display_seat_id, "seat0") == 0) {
                 if (worker->priv->login_vt != worker->priv->session_vt) {
-                        jump_to_vt (worker, worker->priv->login_vt);
+                        jump_to_vt (worker, worker->priv->login_vt, FALSE);
                 }
         }
 
@@ -2007,7 +2009,7 @@ gdm_session_worker_start_session (GdmSessionWorker  *worker,
          * ready, and in the reuse server case, we're already on the correct VT. */
         if (g_strcmp0 (worker->priv->display_seat_id, "seat0") == 0) {
                 if (worker->priv->display_mode == GDM_SESSION_DISPLAY_MODE_NEW_VT) {
-                        jump_to_vt (worker, worker->priv->session_vt);
+                        jump_to_vt (worker, worker->priv->session_vt, TRUE);
                 }
         }
 


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