X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fpoll.c;fp=ccan%2Fio%2Fpoll.c;h=229f7ce9ab4e6fb9bf69ccfd7ae5b650a4463613;hp=98a64f42fbe4336283be8f5371688da439943ac6;hb=f08b8139fc7370224c59bc3178b887810b98592b;hpb=17a81baf84a9c8f89603173be3169a0a2017702d diff --git a/ccan/io/poll.c b/ccan/io/poll.c index 98a64f42..229f7ce9 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -282,9 +282,14 @@ void *io_loop(struct timers *timers, struct timer **expired) break; if (fds[i]->listener) { + struct io_listener *l = (void *)fds[i]; if (events & POLLIN) { - accept_conn((void *)c); + accept_conn(l); r--; + } else if (events & (POLLHUP|POLLNVAL|POLLERR)) { + r--; + errno = EBADF; + io_close_listener(l); } } else if (events & (POLLIN|POLLOUT)) { r--;