[PATCH v2] Cygwin: fhandler_local: Fix get_inet_addr_local to retrieve correct type

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Apr 10 10:43:31 GMT 2025


Hi Yuyi,

On Apr 10 17:11, Yuyi Wang wrote:
> For a datagram socket received by recvfrom, the type param is not
> assigned correctly, making fhandler_socket_local::connect() to return
> WSAEPROTOTYPE.
> ---
>  winsup/cygwin/fhandler/socket_local.cc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/winsup/cygwin/fhandler/socket_local.cc b/winsup/cygwin/fhandler/socket_local.cc
> index 270a1ef31..ea5ee67cc 100644
> --- a/winsup/cygwin/fhandler/socket_local.cc
> +++ b/winsup/cygwin/fhandler/socket_local.cc
> @@ -87,6 +87,8 @@ get_inet_addr_local (const struct sockaddr *in, int inlen,
>        addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
>        *outlen = sizeof addr;
>        memcpy (out, &addr, *outlen);
> +      if (type)
> +	*type = SOCK_DGRAM;
>        return 0;
>      }

Thanks, that's better.  Would you mind sending a v3 with the following
additional entries in the commit message?

Fixes: 2617a91597ca ("* fhandler_socket.cc (get_inet_addr): Handle abstract AF_LOCAL socket.")
Signed-Off-by: <you>


Thanks,
Corinna


More information about the Cygwin-patches mailing list