fde->private_data = private_data;
fde->handler_name = handler_name;
fde->location = location;
- fde->additional_flags = 0;
+ fde->additional_flags = UINT64_MAX;
fde->additional_data = NULL;
DLIST_ADD(poll_ev->fresh, fde);
struct poll_event_context *poll_ev = talloc_get_type_abort(
fde->event_ctx->additional_data, struct poll_event_context);
uint64_t idx = fde->additional_flags;
- uint16_t pollflags = 0;
+ uint16_t pollflags;
+
+ fde->flags = flags;
+
+ if (idx == UINT64_MAX) {
+ /*
+ * poll_event_setup_fresh not yet called after this fde was
+ * added. We don't have to do anything to transfer the changed
+ * flags to the array passed to poll(2)
+ */
+ return;
+ }
+
+ pollflags = 0;
if (flags & TEVENT_FD_READ) {
pollflags |= (POLLIN|POLLHUP);
if (flags & TEVENT_FD_WRITE) {
pollflags |= (POLLOUT);
}
-
poll_ev->fds[idx].events = pollflags;
- fde->flags = flags;
poll_event_wake_pollthread(poll_ev);
}