aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenny Levinsen <kl@kl.wtf>2020-08-28 00:46:58 +0000
committerKenny Levinsen <kl@kl.wtf>2020-08-28 02:54:14 +0200
commit60a8e809b23fab0d77fb21c6336ef7f37c45640c (patch)
treec31d2545176ddf0d0cc70c68500930532dfc3e2e
parent8e0b58f90d5c1e325a7f3a1417ffdc2729bb29d5 (diff)
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.
-rw-r--r--common/terminal.c6
1 files changed, 5 insertions, 1 deletions
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