From 60a8e809b23fab0d77fb21c6336ef7f37c45640c Mon Sep 17 00:00:00 2001 From: Kenny Levinsen Date: Fri, 28 Aug 2020 00:46:58 +0000 Subject: terminal: FreeBSD VT num is 1 higher than tty num This was causing all VT and TTY changes to be applied to the wrong TTY. --- common/terminal.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'common/terminal.c') diff --git a/common/terminal.c b/common/terminal.c index 126641d..77e9235 100644 --- a/common/terminal.c +++ b/common/terminal.c @@ -63,7 +63,11 @@ int terminal_current_vt(int fd) { log_errorf("could not retrieve VT state: %s", strerror(errno)); return -1; } - return vt; + if (vt < 1) { + log_errorf("invalid vt: %d", vt); + return -1; + } + return vt - 1; #else #error Unsupported platform #endif -- cgit v1.2.3