ws2_32: Fix return value when receiving with MSG_OOB without data to read.

This commit is contained in:
Bruno Jesus 2015-03-31 00:06:52 -03:00 committed by Alexandre Julliard
parent 45d64ce26b
commit e845bded34
2 changed files with 5 additions and 2 deletions

View File

@ -6837,6 +6837,11 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
n = WS2_recv( fd, wsa, flags );
if (n == -1)
{
/* Unix-like systems return EINVAL when attempting to read OOB data from
* an empty socket buffer, convert that to a Windows expected return. */
if ((flags & MSG_OOB) && errno == EINVAL)
errno = EWOULDBLOCK;
if (errno != EAGAIN)
{
int loc_errno = errno;

View File

@ -4712,14 +4712,12 @@ static void test_ioctlsocket(void)
ret = recv(dst, &data, 1, i);
ok(ret == SOCKET_ERROR, "expected -1, got %d\n", ret);
ret = GetLastError();
todo_wine
ok(ret == WSAEWOULDBLOCK, "expected 10035, got %d\n", ret);
bufs.len = sizeof(char);
bufs.buf = &data;
ret = WSARecv(dst, &bufs, 1, &bytes_rec, &i, NULL, NULL);
ok(ret == SOCKET_ERROR, "expected -1, got %d\n", ret);
ret = GetLastError();
todo_wine
ok(ret == WSAEWOULDBLOCK, "expected 10035, got %d\n", ret);
optval = 1;
ret = setsockopt(dst, SOL_SOCKET, SO_OOBINLINE, (void *)&optval, sizeof(optval));