]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: correctly handle EOF when using poll() 549/head
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 16 May 2017 18:17:23 +0000 (18:17 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 16 May 2017 18:29:51 +0000 (18:29 +0000)
Descriptor owner should handle EOF, not thread.c

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/thread.c

index aef9ac5cf985f290837225652b90977444f5cf5e..6de4d24bfae883f86c2b88264d24e7c63fb44a62 100644 (file)
@@ -1211,14 +1211,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,