You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/03/23 07:28:26 UTC
[incubator-nuttx] branch master updated: fs/epoll: correct the
return value of epoll_ctl(2)
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4abf8e6 fs/epoll: correct the return value of epoll_ctl(2)
4abf8e6 is described below
commit 4abf8e658754ab5a23046dac232b4ae432bd23ae
Author: chao.an <an...@xiaomi.com>
AuthorDate: Fri Mar 12 13:24:21 2021 +0800
fs/epoll: correct the return value of epoll_ctl(2)
Signed-off-by: chao.an <an...@xiaomi.com>
---
fs/vfs/fs_epoll.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/fs/vfs/fs_epoll.c b/fs/vfs/fs_epoll.c
index 90fb8f9..1375062 100644
--- a/fs/vfs/fs_epoll.c
+++ b/fs/vfs/fs_epoll.c
@@ -283,13 +283,18 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
sizeof(struct pollfd) * (eph->occupied - i));
}
- eph->occupied--;
break;
}
}
- set_errno(ENOENT);
- return -1;
+ if (i > eph->occupied)
+ {
+ set_errno(ENOENT);
+ return -1;
+ }
+
+ eph->occupied--;
+ break;
case EPOLL_CTL_MOD:
finfo("%08x CTL MOD(%d): fd=%d ev=%08" PRIx32 "\n",
@@ -304,8 +309,13 @@ int epoll_ctl(int epfd, int op, int fd, struct epoll_event *ev)
}
}
- set_errno(ENOENT);
- return -1;
+ if (i > eph->occupied)
+ {
+ set_errno(ENOENT);
+ return -1;
+ }
+
+ break;
default:
set_errno(EINVAL);