* (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.
This commit is contained in:
@ -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
|
||||
{
|
||||
|
Reference in New Issue
Block a user