Blame SOURCES/0018-session-worker-fix-current-vt-detection-short-circui.patch

a1b388
From b9e5a2879a410b6a85be6c01c6f49cd7eb24c800 Mon Sep 17 00:00:00 2001
a1b388
From: Ray Strode <rstrode@redhat.com>
a1b388
Date: Fri, 31 Aug 2018 15:20:39 -0400
a1b388
Subject: [PATCH 18/51] session-worker: fix current vt detection short-circuit
a1b388
 logic
a1b388
a1b388
commit 8169cd4 attempts to avoid changing VTs if the active VT
a1b388
is the same as the VT getting jumped to.
a1b388
a1b388
It fails to work, however, because accidentally treats a 0 return
a1b388
code to the VT_GETSTATE ioctl as failure.
a1b388
a1b388
this commit fixes that.
a1b388
---
a1b388
 daemon/gdm-session-worker.c | 2 +-
a1b388
 1 file changed, 1 insertion(+), 1 deletion(-)
a1b388
a1b388
diff --git a/daemon/gdm-session-worker.c b/daemon/gdm-session-worker.c
a1b388
index fd6470bab..391969d96 100644
a1b388
--- a/daemon/gdm-session-worker.c
a1b388
+++ b/daemon/gdm-session-worker.c
a1b388
@@ -963,61 +963,61 @@ jump_to_vt (GdmSessionWorker  *worker,
a1b388
 {
a1b388
         int fd;
a1b388
         int active_vt_tty_fd;
a1b388
         int active_vt = -1;
a1b388
         struct vt_stat vt_state = { 0 };
a1b388
 
a1b388
         g_debug ("GdmSessionWorker: jumping to VT %d", vt_number);
a1b388
         active_vt_tty_fd = open ("/dev/tty0", O_RDWR | O_NOCTTY);
a1b388
 
a1b388
         if (worker->priv->session_tty_fd != -1) {
a1b388
                 fd = worker->priv->session_tty_fd;
a1b388
 
a1b388
                 g_debug ("GdmSessionWorker: first setting graphics mode to prevent flicker");
a1b388
                 if (ioctl (fd, KDSETMODE, KD_GRAPHICS) < 0) {
a1b388
                         g_debug ("GdmSessionWorker: couldn't set graphics mode: %m");
a1b388
                 }
a1b388
 
a1b388
                 /* It's possible that the current VT was left in a broken
a1b388
                  * combination of states (KD_GRAPHICS with VT_AUTO), that
a1b388
                  * can't be switched away from.  This call makes sure things
a1b388
                  * are set in a way that VT_ACTIVATE should work and
a1b388
                  * VT_WAITACTIVE shouldn't hang.
a1b388
                  */
a1b388
                 fix_terminal_vt_mode (worker, active_vt_tty_fd);
a1b388
         } else {
a1b388
                 fd = active_vt_tty_fd;
a1b388
         }
a1b388
 
a1b388
         handle_terminal_vt_switches (worker, fd);
a1b388
 
a1b388
-        if (ioctl (fd, VT_GETSTATE, &vt_state) <= 0) {
a1b388
+        if (ioctl (fd, VT_GETSTATE, &vt_state) < 0) {
a1b388
                 g_debug ("GdmSessionWorker: couldn't get current VT: %m");
a1b388
         } else {
a1b388
                 active_vt = vt_state.v_active;
a1b388
         }
a1b388
 
a1b388
         if (active_vt != vt_number) {
a1b388
                 if (ioctl (fd, VT_ACTIVATE, vt_number) < 0) {
a1b388
                         g_debug ("GdmSessionWorker: couldn't initiate jump to VT %d: %m",
a1b388
                                  vt_number);
a1b388
                 } else if (ioctl (fd, VT_WAITACTIVE, vt_number) < 0) {
a1b388
                         g_debug ("GdmSessionWorker: couldn't finalize jump to VT %d: %m",
a1b388
                                  vt_number);
a1b388
                 }
a1b388
         }
a1b388
 
a1b388
         close (active_vt_tty_fd);
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
 gdm_session_worker_set_state (GdmSessionWorker      *worker,
a1b388
                               GdmSessionWorkerState  state)
a1b388
 {
a1b388
         if (worker->priv->state == state)
a1b388
                 return;
a1b388
 
a1b388
         worker->priv->state = state;
a1b388
         g_object_notify (G_OBJECT (worker), "state");
a1b388
 }
a1b388
 
a1b388
 static void
a1b388
-- 
a1b388
2.27.0
a1b388