diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-06-29 12:52:48 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-06-29 12:52:48 +0000 |
commit | 289edb6f7d261d4dcc34fcf0b85b6cb2a1e94f62 (patch) | |
tree | acda189c457bb40dca2943fda9638115cbad686c /sircbot.c | |
parent | 233f685e2a2a5033b077e9945c4b6f21fe7c5046 (diff) | |
download | sircbot-289edb6f7d261d4dcc34fcf0b85b6cb2a1e94f62.tar.bz2 sircbot-289edb6f7d261d4dcc34fcf0b85b6cb2a1e94f62.tar.xz |
handle POLLHUP from fifos
when process that writes to fifo exits, the fifo is closed.
We handle this by just re-opening it.
Diffstat (limited to 'sircbot.c')
-rw-r--r-- | sircbot.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -348,9 +348,20 @@ 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) && i == 0) - /* server hang up on us */ - return 0; + if (fds[i].revents & POLLHUP) { + if (i == 0) + /* server hang up on us */ + return 0; + + /* one of the fifos closed due to + writer process exit. We just + reopen it assuming we are still + joined the channel */ + close_fifo(&chan[i-1], + chan[i-1].last_closetime); + init_fifo(&chan[i-1]); + continue; + } if (fds[i].revents & POLLERR) goto ret_err; |