diff options
Diffstat (limited to 'sircbot.c')
-rw-r--r-- | sircbot.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -343,13 +343,21 @@ static int irc_loop(struct irc_session *sess, struct sircbot_channel *chan, send_fifo_queue(sess, &chan[i-1], now) < 0) goto ret_err; - if (!(fds[i].revents)) + if (fds[i].revents & POLLHUP) + return 0; + + if (fds[i].revents & POLLERR) + goto ret_err; + + if (!(fds[i].revents & POLLIN)) continue; /* no data available for read */ printf("DEBUG: data available from fds[%i]\n", i); r = read(fds[i].fd, buf, sizeof(buf)-1); if (r < 0) goto ret_err; + if (r == 0) + continue; printf("DEBUG: read %i bytes\n", r); |