ws2_32: Null select() should fail with WSAEINVAL.
This commit is contained in:
parent
d95e2dbd62
commit
6733c40d78
|
@ -3496,7 +3496,11 @@ static struct pollfd *fd_sets_to_poll( const WS_fd_set *readfds, const WS_fd_set
|
|||
if (writefds) count += writefds->fd_count;
|
||||
if (exceptfds) count += exceptfds->fd_count;
|
||||
*count_ptr = count;
|
||||
if (!count) return NULL;
|
||||
if (!count)
|
||||
{
|
||||
SetLastError(WSAEINVAL);
|
||||
return NULL;
|
||||
}
|
||||
if (!(fds = HeapAlloc( GetProcessHeap(), 0, count * sizeof(fds[0]))))
|
||||
{
|
||||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||
|
@ -3619,7 +3623,7 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds,
|
|||
TRACE("read %p, write %p, excp %p timeout %p\n",
|
||||
ws_readfds, ws_writefds, ws_exceptfds, ws_timeout);
|
||||
|
||||
if (!(pollfds = fd_sets_to_poll( ws_readfds, ws_writefds, ws_exceptfds, &count )) && count)
|
||||
if (!(pollfds = fd_sets_to_poll( ws_readfds, ws_writefds, ws_exceptfds, &count )))
|
||||
return SOCKET_ERROR;
|
||||
|
||||
if (ws_timeout)
|
||||
|
|
|
@ -1943,6 +1943,17 @@ static void test_select(void)
|
|||
FD_ZERO(&readfds);
|
||||
FD_ZERO(&writefds);
|
||||
FD_ZERO(&exceptfds);
|
||||
|
||||
SetLastError(0);
|
||||
ret = select(maxfd+1, 0, 0, 0, &select_timeout);
|
||||
ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret);
|
||||
ok ( GetLastError() == WSAEINVAL, "expected WSAEINVAL, got %i\n", ret);
|
||||
|
||||
SetLastError(0);
|
||||
ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout);
|
||||
ok ( (ret == SOCKET_ERROR), "expected SOCKET_ERROR, got %i\n", ret);
|
||||
ok ( GetLastError() == WSAEINVAL, "expected WSAEINVAL, got %i\n", ret);
|
||||
|
||||
FD_SET(INVALID_SOCKET, &readfds);
|
||||
SetLastError(0);
|
||||
ret = select(maxfd+1, &readfds, &writefds, &exceptfds, &select_timeout);
|
||||
|
|
Loading…
Reference in New Issue