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

Alexandre Julliard julliard at wine.codeweavers.com
Tue Mar 31 10:38:50 CDT 2015


Module: wine
Branch: master
Commit: e845bded34247dda124a6355dfd9beda2f17dd01
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e845bded34247dda124a6355dfd9beda2f17dd01

Author: Bruno Jesus <00cpxxx at gmail.com>
Date:   Tue Mar 31 00:06:52 2015 -0300

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

---

 dlls/ws2_32/socket.c     | 5 +++++
 dlls/ws2_32/tests/sock.c | 2 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 4444011..52fd03b 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -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;
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 533e58c..287a24b 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -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));




More information about the wine-cvs mailing list