From eab09848757cbdb7d3ee916291b80975317fda75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 13 Aug 2009 15:14:34 +0000 Subject: [PATCH] * 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 --- src/bin/network/netstat/netstat.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/network/netstat/netstat.cpp b/src/bin/network/netstat/netstat.cpp index b7dfdb5852..85fde801ef 100644 --- a/src/bin/network/netstat/netstat.cpp +++ b/src/bin/network/netstat/netstat.cpp @@ -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. * * Authors: @@ -54,7 +54,7 @@ static void inet_print_address(sockaddr* _address) { sockaddr_in& address = *(sockaddr_in *)_address; - + if (address.sin_family != AF_INET || address.sin_len == 0) { printf("%-22s", "-"); return; @@ -65,7 +65,7 @@ inet_print_address(sockaddr* _address) if (sResolveNames) { host = gethostbyaddr((const char*)&address.sin_addr, sizeof(in_addr), AF_INET); - service = getservbyport(ntohs(address.sin_port), NULL); + service = getservbyport(address.sin_port, NULL); } const char *hostName;