diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2009-08-14 06:58:44 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2009-08-14 06:58:44 +0000 |
commit | c1999c4b0c262112ca1fa38fcd1558b9e91a7bf0 (patch) | |
tree | a5b744dbd5cadb8f8d6007904b972c654f45edff /winsup/cygwin/fhandler_socket.cc | |
parent | 95a1cc70249dd8b0461b91efbf93b78a4af2a672 (diff) | |
download | cygnal-c1999c4b0c262112ca1fa38fcd1558b9e91a7bf0.tar.gz cygnal-c1999c4b0c262112ca1fa38fcd1558b9e91a7bf0.tar.bz2 cygnal-c1999c4b0c262112ca1fa38fcd1558b9e91a7bf0.zip |
* (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.cc | 4 |
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 { |