diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-03-03 14:46:44 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-03-03 14:46:44 +0000 |
commit | a1e0c57258e58a6a7b1a4700af72c04b2c221214 (patch) | |
tree | 25b645f05ad41ec60ec8d25987c47ddaf0d30909 /sircbot.c | |
parent | 4e22cd8f4decc1d419d7ac236f68786a4c6d8311 (diff) | |
download | sircbot-a1e0c57258e58a6a7b1a4700af72c04b2c221214.tar.bz2 sircbot-a1e0c57258e58a6a7b1a4700af72c04b2c221214.tar.xz |
check POLLHUP/POLLERR separately
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); |