libr/cons: Fix SIGWINCH logic (#11470)

Fixes two bugs; puts pselect in a loop to enable resizing window more
than once before there is any input, and reset sigwinchFlag to zero when
resizing window.
This commit is contained in:
Neven Sajko 2018-09-12 11:55:20 +02:00 committed by radare
parent 7f816f53db
commit 2b7990fcee

View File

@ -502,9 +502,11 @@ R_API int r_cons_readchar() {
FD_SET (STDIN_FILENO, &readfds);
r_signal_sigmask (0, NULL, &sigmask);
sigdelset (&sigmask, SIGWINCH);
pselect (STDIN_FILENO + 1, &readfds, NULL, NULL, NULL, &sigmask);
if (sigwinchFlag != 0) {
resizeWin ();
while (pselect (STDIN_FILENO + 1, &readfds, NULL, NULL, NULL, &sigmask) == -1) {
if (sigwinchFlag) {
sigwinchFlag = 0;
resizeWin ();
}
}
ssize_t ret = read (STDIN_FILENO, buf, 1);