ws2_32: negate return value of SIOCATMARK (try 2)
André Hentschel
nerv at dawncrow.de
Wed Apr 28 10:25:55 CDT 2010
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
More information about the wine-patches
mailing list