From 7405e218abf1e570e9c6de20d0a030b7f71f834a Mon Sep 17 00:00:00 2001 From: Hajimu UMEMOTO Date: Thu, 4 May 2006 11:28:16 +0000 Subject: The port number must be network byte order. --- getent.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/getent.c b/getent.c index 94e2e87..0694fdc 100644 --- a/getent.c +++ b/getent.c @@ -509,10 +509,9 @@ services(int argc, char *argv[]) proto = strchr(argv[i], '/'); if (proto != NULL) *proto++ = '\0'; - if (parsenum(argv[i], &id)) { - printf("%lu %s\n", id, proto); - se = getservbyport((int)id, proto); - } else + if (parsenum(argv[i], &id)) + se = getservbyport(htons((u_short)id), proto); + else se = getservbyname(argv[i], proto); if (se != NULL) SERVICESPRINT; -- cgit v1.2.3-56-ge451