[newlib-cygwin/cygwin-3_6-branch] Cygwin: fhandler_local: Fix get_inet_addr_local to retrieve correct type

Corinna Vinschen corinna@sourceware.org
Thu Apr 10 13:20:27 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5d980ecccd12f1b396f7a053795cf913f8dc0816

commit 5d980ecccd12f1b396f7a053795cf913f8dc0816
Author:     Yuyi Wang <Strawberry_Str@hotmail.com>
AuthorDate: Thu Apr 10 20:27:22 2025 +0800
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Thu Apr 10 15:19:56 2025 +0200

    Cygwin: fhandler_local: Fix get_inet_addr_local to retrieve correct type
    
    For a datagram socket received by recvfrom, the type param is not
    assigned correctly, making fhandler_socket_local::connect() to return
    WSAEPROTOTYPE.
    
    Fixes: 2617a91597ca ("* fhandler_socket.cc (get_inet_addr): Handle abstract AF_LOCAL socket.")
    Signed-off-by: Yuyi Wang <Strawberry_Str@hotmail.com>
    (cherry picked from commit 3b06366ed1b752baa1173fac442702d397485d37)

Diff:
---
 winsup/cygwin/fhandler/socket_local.cc | 2 ++
 winsup/cygwin/release/3.6.2            | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/winsup/cygwin/fhandler/socket_local.cc b/winsup/cygwin/fhandler/socket_local.cc
index 270a1ef31c82..ea5ee67cc117 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;
     }
 
diff --git a/winsup/cygwin/release/3.6.2 b/winsup/cygwin/release/3.6.2
index aee5e4408150..ef56a74ffe07 100644
--- a/winsup/cygwin/release/3.6.2
+++ b/winsup/cygwin/release/3.6.2
@@ -4,3 +4,6 @@ Fixes:
 - Fix a high latency problem when trying to fetch SID info for SIDs
   not resolved by Windows functions anyway.
   Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257916.html
+
+- Fix connect(2) returning WSAEPROTOTYPE on abstract sockets.
+  Addresses: https://sourceware.org/pipermail/cygwin-patches/2025q2/013638.html


More information about the Cygwin-cvs mailing list