Fix bug #9 - net_get_peer_address() failure on CentOS/Xen configurations.

Signed-off-by: Jan Vidar Krey <janvidar@extatic.org>
This commit is contained in:
Jan Vidar Krey 2009-03-20 15:07:52 +01:00
parent 77e41371b5
commit 1929f2fae7

View File

@ -465,11 +465,9 @@ const char* net_get_peer_address(int fd)
name4 = (struct sockaddr_in*) &storage;
name = (struct sockaddr*) &storage;
int af = net_is_ipv6_supported() ? AF_INET6 : AF_INET;
if (getpeername(fd, (struct sockaddr*) name, &namelen) != -1)
{
int af = name4->sin_family;
if (af == AF_INET6)
{
net_address_to_string(af, (void*) &name6->sin6_addr, address, INET6_ADDRSTRLEN);