feat: ignore negative fd and clear its revents in poll(2)

This commit is contained in:
Steve Lau
2024-07-20 20:41:52 +08:00
parent bf26de70e2
commit c7300009cd
+6
View File
@@ -57,6 +57,12 @@ pub fn poll_epoll(fds: &mut [pollfd], timeout: c_int) -> c_int {
for i in 0..fds.len() {
let mut pfd = &mut fds[i];
// Ignore the entry with negative fd, set the revents to 0
if pfd.fd < 0 {
pfd.revents = 0;
continue;
}
let mut event = epoll_event {
events: 0,
data: epoll_data { u64: i as u64 },