tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's...
authorJeremy Allison <jra@samba.org>
Thu, 14 Feb 2013 21:52:41 +0000 (13:52 -0800)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Mar 2013 19:00:25 +0000 (20:00 +0100)
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/tevent/tevent_epoll.c

index 19f6809f2721731a8885d68aef8c9f57b2780438..3a3c01c867ba8636498112daaa4994853f0b89d7 100644 (file)
@@ -401,6 +401,13 @@ static void epoll_add_event(struct epoll_event_context *epoll_ev, struct tevent_
                        mpx_fde->event_ctx = NULL;
                }
                return;
+       } else if (ret != 0 && errno == EEXIST && mpx_fde == NULL) {
+               ret = epoll_add_multiplex_fd(epoll_ev, fde);
+               if (ret != 0) {
+                       epoll_panic(epoll_ev, "epoll_add_multiplex_fd failed",
+                                   false);
+                       return;
+               }
        } else if (ret != 0) {
                epoll_panic(epoll_ev, "EPOLL_CTL_ADD failed", false);
                return;