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

ws2_32: Ensure recv functions set last error to zero when they succeed.

parent d4d14cde
......@@ -6776,6 +6776,7 @@ static int WS2_recv_base( SOCKET s, LPWSABUF lpBuffers, DWORD dwBufferCount,
if (wsa != &localwsa) HeapFree( GetProcessHeap(), 0, wsa );
release_sock_fd( s, fd );
_enable_event(SOCKET2HANDLE(s), FD_READ, 0, 0);
SetLastError(ERROR_SUCCESS);
return 0;
......
......@@ -5136,14 +5136,12 @@ static void test_events(int useMessages)
SetLastError(0xdeadbeef);
ret = recv(src, buffer, 1, MSG_PEEK);
ok(ret == 1, "Failed to peek at recv buffer %d err %d\n", ret, GetLastError());
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
ok_event_seq(src, hEvent, read_seq, NULL, 0);
SetLastError(0xdeadbeef);
ret = recv(src, buffer, 50, 0);
ok(ret == 50, "Failed to recv buffer %d err %d\n", ret, GetLastError());
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
ok_event_seq(src, hEvent, read_seq, NULL, 0);
......@@ -5171,7 +5169,6 @@ todo_wine
SetLastError(0xdeadbeef);
ret = recv(src, buffer, 1, 0);
ok(ret == 1, "Failed to recv buffer %d err %d\n", ret, GetLastError());
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
ok_event_seq(src, hEvent, empty_seq, NULL, 0);
......@@ -5603,7 +5600,6 @@ static void test_WSASendMsg(void)
ret = recvfrom(dst, buffer, sizeof(buffer), 0, (struct sockaddr *) &sockaddr, &addrlen);
ok(ret == bytesSent, "got %d, expected %d\n",
ret, bytesSent);
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
/* A successful call to WSASendMsg must have bound the socket */
......@@ -5634,7 +5630,6 @@ todo_wine
ret = recvfrom(dst, buffer, sizeof(buffer), 0, (struct sockaddr *) &sockaddr, &addrlen);
ok(ret == bytesSent, "got %d, expected %d\n",
ret, bytesSent);
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
closesocket(sock);
......@@ -5770,14 +5765,12 @@ static void test_WSARecv(void)
iret = WSARecv(dest, &bufs, 1, &bytesReturned, &flags, NULL, NULL);
ok(!iret, "Expected 0, got %d\n", iret);
ok(bytesReturned, "Expected 2, got %d\n", bytesReturned);
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
SetLastError(0xdeadbeef);
bytesReturned = 0xdeadbeef;
iret = WSARecv(dest, &bufs, 1, &bytesReturned, &flags, NULL, NULL);
ok(!iret, "Expected 0, got %d\n", iret);
ok(bytesReturned, "Expected 2, got %d\n", bytesReturned);
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
bufs.len = 4;
......@@ -5790,7 +5783,6 @@ todo_wine
iret = WSARecv(dest, &bufs, 1, &bytesReturned, &flags, NULL, NULL);
ok(!iret, "Expected 0, got %d\n", iret);
ok(bytesReturned, "Expected 4, got %d\n", bytesReturned);
todo_wine
ok(GetLastError() == ERROR_SUCCESS, "Expected 0, got %d\n", GetLastError());
bufs.len = sizeof(buf);
......
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