minicurses: do not use columns or rows when they are <= 0 - sfeed_curses - sfee… | |
git clone git://git.codemadness.org/sfeed_curses | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 1498a23eb6d0ba3841c9e57045c25a335f5e4e9b | |
parent 28795e476d1775e0cf96a5dd8444e200e5197152 | |
Author: Hiltjo Posthuma <[email protected]> | |
Date: Mon, 21 Dec 2020 14:03:07 +0100 | |
minicurses: do not use columns or rows when they are <= 0 | |
Instead use the default sizes. | |
The ioctl can return success but not have the sizes set. | |
Noticed on qemu -nographic via a console. | |
Diffstat: | |
M minicurses.h | 6 ++++-- | |
1 file changed, 4 insertions(+), 2 deletions(-) | |
--- | |
diff --git a/minicurses.h b/minicurses.h | |
@@ -24,8 +24,10 @@ setupterm(char *term, int fildes, int *errret) | |
if (ioctl(fildes, TIOCGWINSZ, &winsz) == -1) | |
return -1; /* ERR */ | |
- columns = winsz.ws_col; | |
- lines = winsz.ws_row; | |
+ if (winsz.ws_col > 0) | |
+ columns = winsz.ws_col; | |
+ if (winsz.ws_row > 0) | |
+ lines = winsz.ws_row; | |
return 0; /* OK */ | |
} |