Module: wine
Branch: master
Commit: 68cfc95ab6456e5c71f68cfb92cba268d47ee02b
URL: https://gitlab.winehq.org/wine/wine/-/commit/68cfc95ab6456e5c71f68cfb92cba2…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Fri Jul 15 19:52:50 2022 -0500
ws2_32/tests: Work around a Linux bug.
This was reported upstream: https://bugzilla.kernel.org/show_bug.cgi?id=216259
---
dlls/ws2_32/tests/sock.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
index 9f1da1039c4..268b1e6d691 100644
--- a/dlls/ws2_32/tests/sock.c
+++ b/dlls/ws2_32/tests/sock.c
@@ -4422,6 +4422,7 @@ static void test_select(void)
ret = getsockopt(fdWrite, SOL_SOCKET, SO_ERROR, (char*)&id, &len);
ok(!ret, "getsockopt failed with %d\n", WSAGetLastError());
ok(id == 0, "expected 0, got %ld\n", id);
+ set_blocking(fdRead, FALSE);
/* When data is received the receiver gets the read descriptor */
ret = send(fdWrite, "1234", 4, 0);
@@ -4482,6 +4483,14 @@ static void test_select(void)
ok(ret == 1, "expected 1, got %d\n", ret);
ok(tmp_buf[0] == 'A', "expected 'A', got 0x%02X\n", tmp_buf[0]);
+ /* Linux has some odd behaviour (probably a bug) where receiving OOB,
+ * setting SO_OOBINLINE, and then calling recv() again will cause the same
+ * data to be received twice. Avoid that messing with further tests by
+ * calling recv() here. */
+ ret = recv(fdRead, tmp_buf, sizeof(tmp_buf), 0);
+ todo_wine ok(ret == -1, "got %d\n", ret);
+ todo_wine ok(GetLastError() == WSAEWOULDBLOCK, "got error %u\n", WSAGetLastError());
+
/* When the connection is closed the socket is set in the read descriptor */
ret = closesocket(fdRead);
ok(ret == 0, "expected 0, got %d\n", ret);