[PATCH v4] ws2_32: Return WSAEAFNOSUPPORT when ip4/6 disabled

Alexandre Julliard julliard at winehq.org
Thu Nov 15 11:12:17 CST 2018


Brendan McGrath <brendan at redmandi.com> writes:

> @@ -7646,8 +7646,19 @@ SOCKET WINAPI WSASocketW(int af, int type, int protocol,
>          /* invalid combination of valid parameters, like SOCK_STREAM + IPPROTO_UDP */
>          if (err == WSAEINVAL)
>              err = WSAESOCKTNOSUPPORT;
> -        else if (err == WSAEOPNOTSUPP)
> -            err = WSAEPROTONOSUPPORT;
> +        else if (err == WSAEOPNOTSUPP) {
> +          if (unixtype == SOCK_STREAM && protocol == IPPROTO_TCP &&
> +                             (unixaf == AF_INET || unixaf == AF_INET6))
> +              err = WSAEAFNOSUPPORT;
> +          else if (unixtype == SOCK_DGRAM && protocol == IPPROTO_IP &&
> +                             (unixaf == AF_INET || unixaf == AF_INET6))
> +              err = WSAEAFNOSUPPORT;
> +          else if (unixtype == SOCK_DGRAM && protocol == IPPROTO_IPV6 &&
> +                             unixaf == AF_INET6)
> +              err = WSAEAFNOSUPPORT;
> +          else
> +              err = WSAEPROTONOSUPPORT;
> +        }

I'd suggest to find a way to return the specific error from the server,
instead of mapping everything to the same error on the server side and
trying to guess the specific error afterwards.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list