handling when stty reports zero for termsize

If the kernel reports a size of zero for the rows or columns (i.e., what
`stty -a` reports) fall back to the `COLUMNS` and `LINES` variables. If
the resulting values are not reasonable fallback to using 80x24.

Fixes #3740
This commit is contained in:
Kurtis Rader
2017-01-18 13:54:54 -08:00
parent 082d4b5a7e
commit 2be1288cac
6 changed files with 124 additions and 45 deletions

View File

@@ -357,7 +357,7 @@ static void term_steal() {
break;
}
common_handle_winch(0);
invalidate_termsize();
}
int reader_exit_forced() { return exit_forced; }
@@ -1644,7 +1644,7 @@ static void reader_interactive_init() {
exit_without_destructors(1);
}
common_handle_winch(0);
invalidate_termsize();
// Set the new modes.
if (tcsetattr(0, TCSANOW, &shell_modes) == -1) {