Only check revents if nfds > 0
If an error occurs, poll leaves the array unmodified.master
parent
5e9863fa82
commit
f3fb466a31
6
chat.c
6
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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue