Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-08-14 10:58:44 +0400
committerCorinna Vinschen <corinna@vinschen.de>2009-08-14 10:58:44 +0400
commitc1999c4b0c262112ca1fa38fcd1558b9e91a7bf0 (patch)
treea5b744dbd5cadb8f8d6007904b972c654f45edff /winsup/cygwin/fhandler_socket.cc
parent95a1cc70249dd8b0461b91efbf93b78a4af2a672 (diff)
* (fhandler_socket::getsockname): Fix length returned for unbound
AF_LOCAL sockets. (fhandler_socket::getpeername): Ditto. * net.cc (socketpair): Don't set sun_path and peer_sun_path to make sure getsockname and getpeername return the correct values for AF_LOCAL sockets.
Diffstat (limited to 'winsup/cygwin/fhandler_socket.cc')
-rw-r--r--winsup/cygwin/fhandler_socket.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index f213e5d96..52d03ed07 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -1209,7 +1209,7 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen)
if (get_sun_path ())
strncat (sun.sun_path, get_sun_path (), UNIX_PATH_LEN - 1);
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
- *namelen = (int) SUN_LEN (&sun) + 1;
+ *namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0);
res = 0;
}
else
@@ -1283,7 +1283,7 @@ fhandler_socket::getpeername (struct sockaddr *name, int *namelen)
if (get_peer_sun_path ())
strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_LEN - 1);
memcpy (name, &sun, min (*namelen, (int) SUN_LEN (&sun) + 1));
- *namelen = (int) SUN_LEN (&sun) + 1;
+ *namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0);
}
else
{