tevent: don't skip a fd event if the previous one was deleted during poll()
authorStefan Metzmacher <metze@samba.org>
Sun, 17 Feb 2013 22:21:28 +0000 (23:21 +0100)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Mar 2013 09:48:38 +0000 (10:48 +0100)
commit412299a6385b12687a0797b2219188fd5bc9eb71
treef024c63faf0635140eaec04325480379d9768b4f
parent4545b0c8bc96d83f2d55d0d002e6dc0c15140f90
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>
lib/tevent/tevent_poll.c