From 9d1f83e2825442c4aeca467160c918f7ff128392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20TH=C3=89BAULT?= Date: Mon, 20 Apr 2026 08:43:29 +0200 Subject: [PATCH] seatd: use client->session instead of seat->cur_vt in seat_remove_client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a client is removed while a VT switch is in progress, seat->cur_vt may be -1 (set by seat_vt_release before the client acknowledges the disable request). If the client crashes or is killed in this window, seat_remove_client calls vt_close(-1), which fails to open the terminal and skips all cleanup. On FreeBSD, this leaves the keyboard in K_RAW mode permanently, as the kernel does not reset vw_kbdmode when the owning process dies. Use client->session instead, which always holds the correct VT number for the departing client regardless of the seat's transient state. Signed-off-by: Quentin THÉBAULT --- seatd/seat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seatd/seat.c b/seatd/seat.c index 92b79446f00085f909261622ddd968cc8f7b2bd1..d5fb6895ac450135452ba4bb64086d44ae3d7451 100644 --- a/seatd/seat.c +++ b/seatd/seat.c @@ -282,7 +282,7 @@ void seat_remove_client(struct client *client) { // This client was current, but there were no clients // waiting to take this VT, so clean it up. log_debug("Closing active VT"); - vt_close(seat->cur_vt); + vt_close(client->session); } else if (!was_current && client->state != CLIENT_CLOSED) { // This client was not current, but as the client was // running, we need to clean up the VT.