fs/epoll: correct the return value of epoll_ctl(2)

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-03-12 13:24:21 +08:00 committed by Xiang Xiao
parent 9800256507
commit 4abf8e6587

View File

@ -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);