From 94069c977334dc07a172d1af78b77fcdcf3f24ca Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sun, 12 Sep 2010 16:17:09 -0500 Subject: [PATCH 1/2] ws2_32: Add a test for selecting invalid sockets. --- dlls/ws2_32/tests/sock.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 631fcda..16c6fcb 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1939,6 +1939,32 @@ static void test_select(void) broken(thread_params.ReadKilled == 0), /*Win98*/ "closesocket did not wakeup select\n"); + /* Test selecting invalid handles */ + FD_ZERO(&readfds); + FD_ZERO(&writefds); + FD_ZERO(&exceptfds); + FD_SET(INVALID_SOCKET, &readfds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &readfds), "FD should not be set\n"); + + FD_ZERO(&readfds); + FD_SET(INVALID_SOCKET, &writefds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &writefds), "FD should not be set\n"); + + FD_ZERO(&writefds); + FD_SET(INVALID_SOCKET, &exceptfds); + SetLastError(0); + ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout); + todo_wine ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret); + ok ( GetLastError() == WSAENOTSOCK, "expected WSAENOTSOCK, got %i\n", ret); + ok ( !FD_ISSET(fdRead, &exceptfds), "FD should not be set\n"); } static DWORD WINAPI AcceptKillThread(select_thread_params *par) -- 1.6.3.3