aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-03-04 20:03:14 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-03-04 20:03:14 +0000
commit744ecc819e2d34239e47ede7f19d7307289739b9 (patch)
tree6b0df99d34b454bb0d0dc8741ec0e62fe38c4316
parentd70ad9a3834f53f1fd87fecdc876f3a85100cde4 (diff)
downloadsircbot-744ecc819e2d34239e47ede7f19d7307289739b9.tar.bz2
sircbot-744ecc819e2d34239e47ede7f19d7307289739b9.tar.xz
do not logout on POLLHUP from fifos
-rw-r--r--sircbot.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sircbot.c b/sircbot.c
index 4c85772..0999ac5 100644
--- a/sircbot.c
+++ b/sircbot.c
@@ -272,12 +272,12 @@ static void irc_reset_pollfds(struct irc_session *sess, struct pollfd *fds,
int i;
/* first pollfd struc is the irc session */
fds[0].fd = sess->fd;
- fds[0].events = POLLIN | POLLHUP | POLLERR;
+ fds[0].events = POLLIN;
fds[0].revents = 0;
/* rest is channel fifos */
for (i = 1; i < numchan + 1; i++) {
fds[i].fd = chan[i-1].fd;
- fds[i].events = POLLIN | POLLHUP | POLLERR;
+ fds[i].events = POLLIN;
fds[i].revents = 0;
}
}
@@ -347,7 +347,8 @@ 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 & POLLHUP)
+ if ((fds[i].revents & POLLHUP) && i == 0)
+ /* server hang up on us */
return 0;
if (fds[i].revents & POLLERR)