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>
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;