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.
This commit is contained in:
Kenny Levinsen 2020-08-28 00:46:58 +00:00
parent 8e0b58f90d
commit 60a8e809b2

View file

@ -63,7 +63,11 @@ int terminal_current_vt(int fd) {
log_errorf("could not retrieve VT state: %s", strerror(errno)); log_errorf("could not retrieve VT state: %s", strerror(errno));
return -1; return -1;
} }
return vt; if (vt < 1) {
log_errorf("invalid vt: %d", vt);
return -1;
}
return vt - 1;
#else #else
#error Unsupported platform #error Unsupported platform
#endif #endif