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