summaryrefslogtreecommitdiff
path: root/lib/thread.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2017-05-16 18:17:23 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2017-05-17 15:05:42 +0000
commitdbb3cdb601642c1259cffca3b7c85e80e628abd7 (patch)
tree62a0d256ed00f9663be95485a3a3fd1d136cacdb /lib/thread.c
parentb9796a6e01314bf408191545b0eac09c8cfee8a5 (diff)
lib: correctly handle EOF when using poll()
Descriptor owner should handle EOF, not thread.c Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 34802fcedd..dbdd91dd24 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -1052,14 +1052,13 @@ check_pollfds(struct thread_master *m, fd_set *readfd, int num)
ready++;
/* POLLIN / POLLOUT process event */
- if (m->handler.pfds[i].revents & POLLIN)
+ if (m->handler.pfds[i].revents & (POLLIN | POLLHUP))
thread_process_fds_helper(m, m->read[m->handler.pfds[i].fd], NULL, POLLIN, i);
if (m->handler.pfds[i].revents & POLLOUT)
thread_process_fds_helper(m, m->write[m->handler.pfds[i].fd], NULL, POLLOUT, i);
/* remove fd from list on POLLNVAL */
- if (m->handler.pfds[i].revents & POLLNVAL ||
- m->handler.pfds[i].revents & POLLHUP)
+ if (m->handler.pfds[i].revents & POLLNVAL)
{
memmove(m->handler.pfds+i,
m->handler.pfds+i+1,