summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/fhandler_socket.cc
diff options
context:
space:
mode:
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
{