1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-26 14:04:03 +03:00

terminal-util: add recognizable error if cols/rows of tty are initially not initialized

Various tty types come up with cols/rows not initialized (i.e. set to
zero). Let's detect these cases, and return a better error than EIO,
simply to make things easier to debug.
This commit is contained in:
Lennart Poettering 2024-07-17 17:45:26 +02:00
parent ad2fa21f83
commit 0ea4198f0a

View File

@ -855,7 +855,7 @@ int fd_columns(int fd) {
return -errno;
if (ws.ws_col <= 0)
return -EIO;
return -ENODATA; /* some tty types come up with invalid row/column initially, return a recognizable error for that */
return ws.ws_col;
}
@ -892,7 +892,7 @@ int fd_lines(int fd) {
return -errno;
if (ws.ws_row <= 0)
return -EIO;
return -ENODATA; /* some tty types come up with invalid row/column initially, return a recognizable error for that */
return ws.ws_row;
}