tevent: don't skip a fd event if the previous one was deleted during poll()
commitd5b341d873bc326843d80dd15d3cd3ef465234ae
authorStefan Metzmacher <metze@samba.org>
Sun, 17 Feb 2013 22:21:28 +0000 (17 23:21 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 1 Mar 2013 19:59:24 +0000 (1 11:59 -0800)
treef024c63faf0635140eaec04325480379d9768b4f
parentf86df3e364f55be5f320463e3c1b89ee3a49115e
tevent: don't skip a fd event if the previous one was deleted during poll()

In a threaded environment it can happen that an tevent_fd is talloc_free'ed
while the main thread sleeps in the poll() syscall.

In such a case poll_event_fd_destructor() would set poll_ev->fdes[i] = NULL.

We then skip the removed event, but before we also skipped the one
that was located at the end of the array. We moved it to possition
'i', but the next loop uses 'i=i+1'.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/tevent/tevent_poll.c