From 658775faee40e5a9f1b499dd5bc1a66e53066730 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Thu, 7 Dec 2017 22:30:54 +0100 Subject: [PATCH] test: add epoll_ctl_mod() EEXIST and ENOENT tests to test-error --- test/test-error.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/test-error.c b/test/test-error.c index 77be3df..dc6b852 100644 --- a/test/test-error.c +++ b/test/test-error.c @@ -115,6 +115,20 @@ int main(void) { r = epoll_ctl(ep_type, -1, sock_hinv, &ev); check_error(r < 0, EBADF, ERROR_INVALID_HANDLE); + /* Socket already in epoll set. */ + r = epoll_ctl(ep_good, EPOLL_CTL_ADD, sock_good, &ev); + check(r == 0); + r = epoll_ctl(ep_good, EPOLL_CTL_ADD, sock_good, &ev); + check_error(r < 0, EEXIST, ERROR_ALREADY_EXISTS); + + /* Socket not in epoll set. */ + r = epoll_ctl(ep_good, EPOLL_CTL_DEL, sock_good, NULL); + check(r == 0); + r = epoll_ctl(ep_good, EPOLL_CTL_MOD, sock_good, &ev); + check_error(r < 0, ENOENT, ERROR_NOT_FOUND); + r = epoll_ctl(ep_good, EPOLL_CTL_DEL, sock_good, NULL); + check_error(r < 0, ENOENT, ERROR_NOT_FOUND); + r = closesocket(sock_good); check(r == 0); r = epoll_close(ep_good);