Commit ffe20add authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

ws2_32: Explicitly return WSAENOTSOCK for a file handle in getsockopt() except SO_OPENTYPE.

parent 2a45917a
...@@ -1363,6 +1363,13 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl ...@@ -1363,6 +1363,13 @@ int WINAPI getsockopt( SOCKET s, int level, int optname, char *optval, int *optl
debugstr_sockopt(level, optname), debugstr_optval(optval, 0), debugstr_sockopt(level, optname), debugstr_optval(optval, 0),
optlen, optlen ? *optlen : 0); optlen, optlen ? *optlen : 0);
if ((level != SOL_SOCKET || optname != SO_OPENTYPE) &&
!socket_list_find( s ))
{
SetLastError( WSAENOTSOCK );
return SOCKET_ERROR;
}
switch(level) switch(level)
{ {
case SOL_SOCKET: case SOL_SOCKET:
......
...@@ -11693,8 +11693,8 @@ static void test_sockopt_validity(void) ...@@ -11693,8 +11693,8 @@ static void test_sockopt_validity(void)
}; };
static const struct sockopt_validity_test file_handle_tests[] = static const struct sockopt_validity_test file_handle_tests[] =
{ {
{ -1, WSAENOTSOCK, 0, TRUE }, { -1, WSAENOTSOCK },
{ SO_TYPE, WSAENOTSOCK, 0, TRUE }, { SO_TYPE, WSAENOTSOCK },
{ SO_OPENTYPE }, { SO_OPENTYPE },
{} {}
}; };
......
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