[PATCH 4/6] ws2_32: Implement setsockopt(SO_DONTLINGER) on top of Win32 setsockopt(SO_LINGER).
Zebediah Figura
z.figura12 at gmail.com
Thu Jun 24 22:32:48 CDT 2021
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
dlls/ws2_32/socket.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index 112376e583c..776268b381a 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -3506,7 +3506,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
{
int fd;
int woptval;
- struct linger linger;
struct timeval tval;
struct ip_mreq_source mreq_source;
@@ -3529,6 +3528,21 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
case WS_SO_BROADCAST:
return server_setsockopt( s, IOCTL_AFD_WINE_SET_SO_BROADCAST, optval, optlen );
+ case WS_SO_DONTLINGER:
+ {
+ struct WS_linger linger;
+
+ if (!optval)
+ {
+ SetLastError( WSAEFAULT );
+ return -1;
+ }
+
+ linger.l_onoff = !*(const BOOL *)optval;
+ linger.l_linger = 0;
+ return WS_setsockopt( s, WS_SOL_SOCKET, WS_SO_LINGER, (char *)&linger, sizeof(linger) );
+ }
+
case WS_SO_ERROR:
FIXME( "SO_ERROR, stub!\n" );
SetLastError( WSAENOPROTOOPT );
@@ -3545,20 +3559,6 @@ int WINAPI WS_setsockopt(SOCKET s, int level, int optname,
* to the general case. Special options that are not passed to
* setsockopt follow below that.*/
- case WS_SO_DONTLINGER:
- if (!optval)
- {
- SetLastError(WSAEFAULT);
- return SOCKET_ERROR;
- }
- linger.l_onoff = *(const int*)optval == 0;
- linger.l_linger = 0;
- level = SOL_SOCKET;
- optname = SO_LINGER;
- optval = (char*)&linger;
- optlen = sizeof(struct linger);
- break;
-
case WS_SO_SNDBUF:
if (!*(const int *)optval)
{
--
2.30.2
More information about the wine-devel
mailing list