tevent: don't skip a fd event if the previous one was deleted during poll()
commita73331602625b5b5e8a3d6d86bd85658efb7c3ed
authorStefan Metzmacher <metze@samba.org>
Sun, 17 Feb 2013 22:21:28 +0000 (17 23:21 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 6 Mar 2013 09:11:59 +0000 (6 10:11 +0100)
tree515eeeb2254b80c3ae07fd300ea7e01e518b7256
parent7a28c62b0797522e1f1f8cf04b9ffd006ded1aa2
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