From 4b5af957ac68edd016f642e00e67cc60ba843e4b Mon Sep 17 00:00:00 2001 From: wangjianyu3 Date: Tue, 24 Jun 2025 18:35:02 +0800 Subject: [PATCH] system/fastboot: remove interest and close epoll Remove fds from the interest list and close epoll if need. Signed-off-by: wangjianyu3 --- system/fastboot/fastboot.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/system/fastboot/fastboot.c b/system/fastboot/fastboot.c index 569d5c961..190040e55 100644 --- a/system/fastboot/fastboot.c +++ b/system/fastboot/fastboot.c @@ -1008,7 +1008,7 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx, if (epoll_ctl(epfd, EPOLL_CTL_ADD, c->tran_fd[0], &ev[n]) < 0) { fb_err("err add poll %d", c->tran_fd[0]); - return; + goto epoll_close; } } @@ -1016,7 +1016,7 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx, { if (epoll_wait(epfd, ev, nitems(ev), ctx->left) <= 0) { - return; + goto epoll_close; } } @@ -1061,6 +1061,14 @@ static void fastboot_command_loop(FAR struct fastboot_ctx_s *ctx, } } } + +epoll_close: + while (--c >= ctx) + { + epoll_ctl(epfd, EPOLL_CTL_DEL, c->tran_fd[0], NULL); + } + + close(epfd); } static void fastboot_publish(FAR struct fastboot_ctx_s *ctx,