summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-02-14 13:52:41 -0800
committerJeremy Allison <jra@samba.org>2013-03-01 12:01:24 -0800
commit4fcc94d852fcc19c304be50edc07914ea2f8d0c8 (patch)
tree6ae36b6b4826a958c5ecda3171fef42386cf172c
parent16a072ec1cddd75f6df656f69935ad55f71f4a28 (diff)
downloadsamba-4fcc94d852fcc19c304be50edc07914ea2f8d0c8.tar.gz
samba-4fcc94d852fcc19c304be50edc07914ea2f8d0c8.tar.bz2
samba-4fcc94d852fcc19c304be50edc07914ea2f8d0c8.zip
tevent: If epoll_ctl(..EPOLL_CTL_ADD,..) failes with EEXIST, merge the two fde's into one epoll event.
Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r--lib/tevent/tevent_epoll.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 19f6809f27..3a3c01c867 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -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;