From 744ecc819e2d34239e47ede7f19d7307289739b9 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Thu, 4 Mar 2010 20:03:14 +0000 Subject: do not logout on POLLHUP from fifos --- sircbot.c | 7 ++++--- 1 file 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) -- cgit v1.2.3