This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 648d392c97d9f27922a89120a82a5b245c3900c5 Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 26 08:34:12 2026 +0100 fs/vfs/fs_epoll.c: Return ENOENT for an fd that is not in the set. epoll_ctl() with EPOLL_CTL_DEL or EPOLL_CTL_MOD for a file descriptor that is not in the epoll set looked through the three lists, found nothing and returned 0. Linux (and the epoll_ctl(2) man page) gives -1 with errno ENOENT. Return -ENOENT when no list has the fd. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- fs/vfs/fs_epoll.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c index 9801e90ee5f..16acead23fb 100644 --- a/fs/vfs/fs_epoll.c +++ b/fs/vfs/fs_epoll.c @@ -888,7 +888,10 @@ int epoll_ctl(int epfd, int op, int fd, FAR struct epoll_event *ev) } } - break; + /* The file descriptor is not in the set */ + + ret = -ENOENT; + goto err; case EPOLL_CTL_MOD: finfo("%p CTL MOD: fd=%d ev=%08" PRIx32 "\n", eph, fd, ev->events); @@ -964,11 +967,14 @@ int epoll_ctl(int epfd, int op, int fd, FAR struct epoll_event *ev) list_delete(&epn->node); list_add_tail(&eph->setup, &epn->node); - break; + goto out; } } - break; + /* The file descriptor is not in the set */ + + ret = -ENOENT; + goto err; default: ret = -EINVAL;
