epoll_create: reject size <= 0
Even though the size parameter to epoll_create(2) is (otherwise) unused,
passing in size <= 0 is explicitly documented as an error.
This change fixes the LTP epoll01 testcase.
Change-Id: I044a38be823c2fa956b57e77cc66571dfae8a4bb
Signed-off-by: Greg Hackmann <ghackmann@google.com>
diff --git a/tests/sys_epoll_test.cpp b/tests/sys_epoll_test.cpp
index 6e7a807..f6be4af 100644
--- a/tests/sys_epoll_test.cpp
+++ b/tests/sys_epoll_test.cpp
@@ -40,6 +40,12 @@
ASSERT_EQ(0, epoll_pwait(epoll_fd, events, 1, 1, &ss));
}
+TEST(sys_epoll, epoll_create_invalid_size) {
+ errno = 0;
+ ASSERT_EQ(-1, epoll_create(0));
+ ASSERT_EQ(EINVAL, errno);
+}
+
TEST(sys_epoll, epoll_event_data) {
int epoll_fd = epoll_create(1);
ASSERT_NE(-1, epoll_fd) << strerror(errno);