From 2b7990fcee84241e6ff7de5aa9dae3d389cfe485 Mon Sep 17 00:00:00 2001 From: Neven Sajko Date: Wed, 12 Sep 2018 11:55:20 +0200 Subject: [PATCH] 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. --- libr/cons/input.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libr/cons/input.c b/libr/cons/input.c index 6e9692016c..ef12ffa997 100644 --- a/libr/cons/input.c +++ b/libr/cons/input.c @@ -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);