From 95051238c47ac11bf2ca7a247068b15096c8a4ac Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Sun, 12 Sep 2010 16:19:56 -0500 Subject: [PATCH 2/2] ws2_32: Fail when select is called with an invalid fd. --- dlls/ws2_32/socket.c | 6 +++++- dlls/ws2_32/tests/sock.c | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 0335d41..1ba925e 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -3182,7 +3182,7 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, struct pollfd *pollfds; struct timeval tv1, tv2; int torig = 0; - int count, ret, timeout = -1; + int count, ret, timeout = -1, i; TRACE("read %p, write %p, excp %p timeout %p\n", ws_readfds, ws_writefds, ws_exceptfds, ws_timeout); @@ -3193,6 +3193,10 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, return SOCKET_ERROR; } + for (i=0; itv_sec * 1000) + (ws_timeout->tv_usec + 999) / 1000; diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c index 16c6fcb..b2a22af 100644 --- a/dlls/ws2_32/tests/sock.c +++ b/dlls/ws2_32/tests/sock.c @@ -1946,7 +1946,7 @@ static void test_select(void) 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 ( (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"); @@ -1954,7 +1954,7 @@ static void test_select(void) 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 ( (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"); @@ -1962,7 +1962,7 @@ static void test_select(void) 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 ( (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"); } -- 1.6.3.3