From b3fa3d92e3ebae9b224a0111427d6bdd8b869399 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 27 Nov 2023 14:59:06 +0100 Subject: [PATCH] uloop: reset flags after __uloop_fd_delete call Fixes fd delete with kqueue, which relies on the previous flags value Signed-off-by: Felix Fietkau --- uloop.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uloop.c b/uloop.c index ebd7839..da6f690 100644 --- a/uloop.c +++ b/uloop.c @@ -264,6 +264,7 @@ out: int uloop_fd_delete(struct uloop_fd *fd) { + int ret; int i; for (i = 0; i < cur_nfds; i++) { @@ -280,9 +281,11 @@ int uloop_fd_delete(struct uloop_fd *fd) uloop_fd_set_cb(fd, 0); fd->registered = false; - fd->flags = 0; uloop_fd_stack_event(fd, -1); - return __uloop_fd_delete(fd); + ret = __uloop_fd_delete(fd); + fd->flags = 0; + + return ret; } static int64_t tv_diff(struct timeval *t1, struct timeval *t2)