]> git.cameronkatri.com Git - getent-darwin.git/commitdiff
The port number must be network byte order.
authorHajimu UMEMOTO <ume@FreeBSD.org>
Thu, 4 May 2006 11:28:16 +0000 (11:28 +0000)
committerHajimu UMEMOTO <ume@FreeBSD.org>
Thu, 4 May 2006 11:28:16 +0000 (11:28 +0000)
getent.c

index 94e2e877b69688bf929b8a24d05229f8eb230ce3..0694fdc751f715b6a6d2ce7165dce29a682f44de 100644 (file)
--- 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;