1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

tevent: revalidate fde->flags after poll()

This is important to avoid races between threads if the poll_mt
backend is used.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2013-03-01 16:43:35 +01:00 committed by Jeremy Allison
parent 6952d761d2
commit b53c704a34

View File

@ -594,6 +594,12 @@ static int poll_event_loop_poll(struct tevent_context *ev,
if (pfd->revents & POLLOUT) {
flags |= TEVENT_FD_WRITE;
}
/*
* Note that fde->flags could be changed when using
* the poll_mt backend together with threads,
* that why we need to check pfd->revents and fde->flags
*/
flags &= fde->flags;
if (flags != 0) {
fde->handler(ev, fde, flags, fde->private_data);
return 0;