* getservbyport() expects the port in network byte order. Resolving port names
is now working as expected. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32318 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
* Copyright 2006-2009, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -54,7 +54,7 @@ static void
|
|||||||
inet_print_address(sockaddr* _address)
|
inet_print_address(sockaddr* _address)
|
||||||
{
|
{
|
||||||
sockaddr_in& address = *(sockaddr_in *)_address;
|
sockaddr_in& address = *(sockaddr_in *)_address;
|
||||||
|
|
||||||
if (address.sin_family != AF_INET || address.sin_len == 0) {
|
if (address.sin_family != AF_INET || address.sin_len == 0) {
|
||||||
printf("%-22s", "-");
|
printf("%-22s", "-");
|
||||||
return;
|
return;
|
||||||
@@ -65,7 +65,7 @@ inet_print_address(sockaddr* _address)
|
|||||||
if (sResolveNames) {
|
if (sResolveNames) {
|
||||||
host = gethostbyaddr((const char*)&address.sin_addr, sizeof(in_addr),
|
host = gethostbyaddr((const char*)&address.sin_addr, sizeof(in_addr),
|
||||||
AF_INET);
|
AF_INET);
|
||||||
service = getservbyport(ntohs(address.sin_port), NULL);
|
service = getservbyport(address.sin_port, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *hostName;
|
const char *hostName;
|
||||||
|
|||||||
Reference in New Issue
Block a user