Commit fb3956fc authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

ws2_32: Use IOCTL_AFD_WINE_GET_SO_ERROR.

parent 8211c3ab
...@@ -694,19 +694,6 @@ static inline void release_sock_fd( SOCKET s, int fd ) ...@@ -694,19 +694,6 @@ static inline void release_sock_fd( SOCKET s, int fd )
close( fd ); close( fd );
} }
static void _get_sock_errors(SOCKET s, int *events)
{
SERVER_START_REQ( get_socket_event )
{
req->handle = wine_server_obj_handle( SOCKET2HANDLE(s) );
req->service = FALSE;
req->c_event = 0;
wine_server_set_reply( req, events, sizeof(int) * FD_MAX_EVENTS );
wine_server_call( req );
}
SERVER_END_REQ;
}
static int _get_fd_type(int fd) static int _get_fd_type(int fd)
{ {
int sock_type = -1; int sock_type = -1;
...@@ -2236,33 +2223,7 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, ...@@ -2236,33 +2223,7 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level,
return 0; return 0;
case WS_SO_ERROR: case WS_SO_ERROR:
{ return server_getsockopt( s, IOCTL_AFD_WINE_GET_SO_ERROR, optval, optlen );
if ( (fd = get_sock_fd( s, 0, NULL )) == -1)
return SOCKET_ERROR;
if (getsockopt(fd, SOL_SOCKET, SO_ERROR, optval, (socklen_t *)optlen) != 0 )
{
SetLastError(wsaErrno());
ret = SOCKET_ERROR;
}
release_sock_fd( s, fd );
/* The wineserver may have swallowed the error before us */
if (!ret && *(int*) optval == 0)
{
int i, events[FD_MAX_EVENTS];
_get_sock_errors(s, events);
for (i = 0; i < FD_MAX_EVENTS; i++)
{
if(events[i])
{
TRACE("returning SO_ERROR %d from wine server\n", events[i]);
*(int*) optval = events[i];
break;
}
}
}
return ret;
}
case WS_SO_LINGER: case WS_SO_LINGER:
{ {
......
...@@ -1295,7 +1295,6 @@ todo_wine ...@@ -1295,7 +1295,6 @@ todo_wine
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
i = 4321; i = 4321;
err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size); err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
todo_wine
ok( !err && !WSAGetLastError(), ok( !err && !WSAGetLastError(),
"got %d with %d (expected 0 with 0)\n", "got %d with %d (expected 0 with 0)\n",
err, WSAGetLastError()); err, WSAGetLastError());
...@@ -1306,7 +1305,6 @@ todo_wine ...@@ -1306,7 +1305,6 @@ todo_wine
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
size = 1; size = 1;
err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size); err = getsockopt(s, SOL_SOCKET, SO_ERROR, (char *) &i, &size);
todo_wine
ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEFAULT), ok( (err == SOCKET_ERROR) && (WSAGetLastError() == WSAEFAULT),
"got %d with %d (expected SOCKET_ERROR with WSAEFAULT)\n", "got %d with %d (expected SOCKET_ERROR with WSAEFAULT)\n",
err, WSAGetLastError()); err, WSAGetLastError());
......
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