diff options
author | June McEnroe <june@causal.agency> | 2020-02-04 19:06:54 -0500 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2020-02-04 19:06:54 -0500 |
commit | f3fb466a31d78431a686981b7d9b718385591bce (patch) | |
tree | eeaac9ef363fa585c7d574ec70eb9ae36fc7fa06 /chat.c | |
parent | Handle signals in poll loop (diff) | |
download | test-f3fb466a31d78431a686981b7d9b718385591bce.tar.gz test-f3fb466a31d78431a686981b7d9b718385591bce.zip |
Only check revents if nfds > 0
If an error occurs, poll leaves the array unmodified.
Diffstat (limited to '')
-rw-r--r-- | chat.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/chat.c b/chat.c index 3aa4ad2..1656a53 100644 --- a/chat.c +++ b/chat.c @@ -125,11 +125,11 @@ int main(int argc, char *argv[]) { if (signals[SIGWINCH]) { signals[SIGWINCH] = 0; cursesWinch(SIGWINCH); - fds[0].revents = POLLIN; + uiRead(); } - if (fds[0].revents) uiRead(); - if (fds[1].revents) ircRecv(); + if (nfds > 0 && fds[0].revents) uiRead(); + if (nfds > 0 && fds[1].revents) ircRecv(); uiDraw(); } |