Commit 06d759ed authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

ws2_32: Invert SIOCATMARK logic.

parent 8ad904c3
......@@ -3133,7 +3133,14 @@ INT WINAPI WSAIoctl(SOCKET s, DWORD code, LPVOID in_buff, DWORD in_size, LPVOID
|| (!oob && ioctl(fd, SIOCATMARK, &atmark ) == -1))
status = (errno == EBADF) ? WSAENOTSOCK : wsaErrno();
else
(*(WS_u_long *) out_buff) = oob | atmark;
{
/* The SIOCATMARK value read from ioctl() is reversed
* because BSD returns TRUE if it's in the OOB mark
* while Windows returns TRUE if there are NO OOB bytes.
*/
(*(WS_u_long *) out_buff) = oob | !atmark;
}
release_sock_fd( s, fd );
break;
}
......
......@@ -506,7 +506,7 @@ static VOID WINAPI oob_server ( server_params *par )
/* check atmark state */
ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark );
todo_wine ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark );
ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark );
/* Receive normal data and check atmark state */
n_recvd = do_synchronous_recv ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen );
......@@ -516,7 +516,7 @@ static VOID WINAPI oob_server ( server_params *par )
ok ( pos == -1, "simple_server (%x): test pattern error: %d\n", id, pos);
ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark );
todo_wine ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark );
ok ( atmark == 1, "oob_server (%x): unexpectedly at the OOB mark: %i\n", id, atmark );
/* Receive a part of the out-of-band data and check atmark state */
n_recvd = do_synchronous_recv ( mem->sock[0].s, mem->sock[0].buf, 8, par->buflen );
......@@ -525,13 +525,13 @@ static VOID WINAPI oob_server ( server_params *par )
n_expected -= 8;
ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark );
ok ( atmark == 0, "oob_server (%x): not at the OOB mark: %i\n", id, atmark );
todo_wine ok ( atmark == 0, "oob_server (%x): not at the OOB mark: %i\n", id, atmark );
/* Receive the rest of the out-of-band data and check atmark state */
do_synchronous_recv ( mem->sock[0].s, mem->sock[0].buf, n_expected, par->buflen );
ioctlsocket ( mem->sock[0].s, SIOCATMARK, &atmark );
ok ( atmark == 0, "oob_server (%x): not at the OOB mark: %i\n", id, atmark );
todo_wine ok ( atmark == 0, "oob_server (%x): not at the OOB mark: %i\n", id, atmark );
/* cleanup */
wsa_ok ( closesocket ( mem->sock[0].s ), 0 ==, "oob_server (%x): closesocket error: %d\n" );
......@@ -2970,7 +2970,7 @@ static void test_ioctlsocket(void)
ret = ioctlsocket(sock, SIOCATMARK, &arg);
ok(ret != SOCKET_ERROR, "ioctlsocket failed unexpectedly\n");
todo_wine ok(arg, "SIOCATMARK expected a non-zero value\n");
ok(arg, "SIOCATMARK expected a non-zero value\n");
/* when SO_OOBINLINE is set SIOCATMARK must always return TRUE */
optval = 1;
......@@ -2987,7 +2987,7 @@ static void test_ioctlsocket(void)
ok(ret != SOCKET_ERROR, "setsockopt failed unexpectedly\n");
arg = 0;
ret = ioctlsocket(sock, SIOCATMARK, &arg);
todo_wine ok(arg, "SIOCATMARK expected a non-zero value\n");
ok(arg, "SIOCATMARK expected a non-zero value\n");
ret = WSAIoctl(sock, SIO_KEEPALIVE_VALS, &arg, 0, NULL, 0, &arg, NULL, NULL);
ok(ret == SOCKET_ERROR, "WSAIoctl succeeded unexpectedly\n");
......
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