Bruno Jesus : ws2_32: Make getsockopt(SO_TYPE) convert the returned socket type.
Alexandre Julliard
julliard at winehq.org
Thu Sep 19 17:21:01 CDT 2013
Module: wine
Branch: master
Commit: e9bd764a7b82767941cac827843f02bd1bfc3d30
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e9bd764a7b82767941cac827843f02bd1bfc3d30
Author: Bruno Jesus <00cpxxx at gmail.com>
Date: Wed Sep 18 17:36:25 2013 -0300
ws2_32: Make getsockopt(SO_TYPE) convert the returned socket type.
---
dlls/ws2_32/socket.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 8a790f3..2cb077e 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2937,7 +2937,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
case WS_SO_RCVBUF:
case WS_SO_REUSEADDR:
case WS_SO_SNDBUF:
- case WS_SO_TYPE:
if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
return SOCKET_ERROR;
convert_sockopt(&level, &optname);
@@ -3136,6 +3135,27 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
return ret;
}
#endif
+ case WS_SO_TYPE:
+ {
+ if (!optlen || *optlen < sizeof(int) || !optval)
+ {
+ SetLastError(WSAEFAULT);
+ return SOCKET_ERROR;
+ }
+ if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
+ return SOCKET_ERROR;
+
+ if (getsockopt(fd, SOL_SOCKET, SO_TYPE, optval, (socklen_t *)optlen) != 0 )
+ {
+ SetLastError((errno == EBADF) ? WSAENOTSOCK : wsaErrno());
+ ret = SOCKET_ERROR;
+ }
+ else
+ (*(int *)optval) = convert_socktype_u2w(*(int *)optval);
+
+ release_sock_fd( s, fd );
+ return ret;
+ }
default:
TRACE("Unknown SOL_SOCKET optname: 0x%08x\n", optname);
SetLastError(WSAENOPROTOOPT);
More information about the wine-cvs
mailing list