* (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:
parent
95a1cc7024
commit
c1999c4b0c
|
@ -1,3 +1,12 @@
|
|||
2009-08-14 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* (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.
|
||||
|
||||
2009-08-13 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* fhandler_socket.cc (fhandler_socket::accept): Use sizeof rather
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -2866,8 +2866,6 @@ socketpair (int family, int type, int protocol, int *sb)
|
|||
|
||||
if (sb0 >= 0 && fdsock (sb0, dev, insock))
|
||||
{
|
||||
((fhandler_socket *) sb0)->set_sun_path ("");
|
||||
((fhandler_socket *) sb0)->set_peer_sun_path ("");
|
||||
((fhandler_socket *) sb0)->set_addr_family (family);
|
||||
((fhandler_socket *) sb0)->set_socket_type (type);
|
||||
((fhandler_socket *) sb0)->connect_state (connected);
|
||||
|
@ -2878,8 +2876,6 @@ socketpair (int family, int type, int protocol, int *sb)
|
|||
|
||||
if (sb1 >= 0 && fdsock (sb1, dev, outsock))
|
||||
{
|
||||
((fhandler_socket *) sb1)->set_sun_path ("");
|
||||
((fhandler_socket *) sb1)->set_peer_sun_path ("");
|
||||
((fhandler_socket *) sb1)->set_addr_family (family);
|
||||
((fhandler_socket *) sb1)->set_socket_type (type);
|
||||
((fhandler_socket *) sb1)->connect_state (connected);
|
||||
|
|
Loading…
Reference in New Issue