From 11d7a0395fa222360840d79c118921e8b9777861 Mon Sep 17 00:00:00 2001 From: Bert Belder Date: Mon, 4 Dec 2017 21:04:58 +0100 Subject: [PATCH] api: report EINVAL when ephnd is a valid handle but not an epoll instance --- src/api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/api.c b/src/api.c index 7f16269..dce2fe5 100644 --- a/src/api.c +++ b/src/api.c @@ -66,7 +66,7 @@ int epoll_close(HANDLE ephnd) { tree_node = reflock_tree_del_and_ref(&_epoll_handle_tree, (uintptr_t) ephnd); if (tree_node == NULL) - return_error(-1, ERROR_INVALID_HANDLE); + return_handle_error(-1, ephnd, ERROR_INVALID_PARAMETER); port_info = _handle_tree_node_to_port(tree_node); ep_port_close(port_info); @@ -87,7 +87,7 @@ int epoll_ctl(HANDLE ephnd, int op, SOCKET sock, struct epoll_event* ev) { tree_node = reflock_tree_find_and_ref(&_epoll_handle_tree, (uintptr_t) ephnd); if (tree_node == NULL) - return_error(-1, ERROR_INVALID_HANDLE); + return_handle_error(-1, ephnd, ERROR_INVALID_PARAMETER); port_info = _handle_tree_node_to_port(tree_node); result = ep_port_ctl(port_info, op, sock, ev); @@ -111,7 +111,7 @@ int epoll_wait(HANDLE ephnd, tree_node = reflock_tree_find_and_ref(&_epoll_handle_tree, (uintptr_t) ephnd); if (tree_node == NULL) - return_error(-1, ERROR_INVALID_HANDLE); + return_handle_error(-1, ephnd, ERROR_INVALID_PARAMETER); port_info = _handle_tree_node_to_port(tree_node); result = ep_port_wait(port_info, events, maxevents, timeout);