Commit e845bded authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

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

parent 45d64ce2
......@@ -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;
......
......@@ -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));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment