ws2_32: negate return value of SIOCATMARK (try 2)
Mike Kaplinskiy
mike.kaplinskiy at gmail.com
Thu Apr 29 11:39:32 CDT 2010
2010/4/28 André Hentschel <nerv at dawncrow.de>:
> confirmed by Mike Kaplinskiy
>
> try 1 was on 4th November 2009
>
> ---
> dlls/ws2_32/socket.c | 16 ++++++++++++++--
> dlls/ws2_32/tests/sock.c | 2 +-
> 2 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
> index e6a6973..62598d2 100644
> --- a/dlls/ws2_32/socket.c
> +++ b/dlls/ws2_32/socket.c
> @@ -2800,8 +2800,20 @@ int WINAPI WS_ioctlsocket(SOCKET s, LONG cmd, WS_u_long *argp)
> return 0;
>
> case WS_SIOCATMARK:
> - newcmd=SIOCATMARK;
> - break;
> + fd = get_sock_fd( s, 0, NULL );
> + if (fd != -1)
> + {
> + if( ioctl(fd, newcmd, (char*)argp ) == 0 )
> + {
> + release_sock_fd( s, fd );
> + /* return value must be inverted here */
> + *argp = !*argp;
> + return 0;
> + }
> + SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
> + release_sock_fd( s, fd );
> + }
> + return SOCKET_ERROR;
>
> case WS_FIOASYNC:
> WARN("Warning: WS1.1 shouldn't be using async I/O\n");
> diff --git a/dlls/ws2_32/tests/sock.c b/dlls/ws2_32/tests/sock.c
> index 88b62e3..7a7c688 100644
> --- a/dlls/ws2_32/tests/sock.c
> +++ b/dlls/ws2_32/tests/sock.c
> @@ -2486,7 +2486,7 @@ static void test_ioctlsocket(void)
>
> ret = ioctlsocket(sock, SIOCATMARK, &arg);
> if(ret != SOCKET_ERROR)
> - todo_wine ok(arg, "expected a non-zero value\n");
> + ok(arg, "expected a non-zero value\n");
> }
>
> static int drain_pause=0;
> --
>
> Best Regards, André Hentschel
>
>
>
>
Hey André,
I don't think we should rush this. The documentation says that the
return values are basically opposites, but I think we need more tests
with actual OOB data and different settings of SO_OOBINBLINE. MSDN has
far too little information about SIOCATMARK and some things they say
don't make a lot of sense.
Mike.
More information about the wine-devel
mailing list