diff options
Diffstat (limited to 'common/terminal.c')
-rw-r--r-- | common/terminal.c | 6 |
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 |