diff options
author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2006-05-04 11:28:16 +0000 |
---|---|---|
committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2006-05-04 11:28:16 +0000 |
commit | 7405e218abf1e570e9c6de20d0a030b7f71f834a (patch) | |
tree | 216004b6ad67fa93f4e31f273e51c2f4a9b1d828 /getent.c | |
parent | 3ac0118fed5d142df76e276e686b59154bb91a9e (diff) | |
download | getent-darwin-7405e218abf1e570e9c6de20d0a030b7f71f834a.tar.gz getent-darwin-7405e218abf1e570e9c6de20d0a030b7f71f834a.tar.zst getent-darwin-7405e218abf1e570e9c6de20d0a030b7f71f834a.zip |
The port number must be network byte order.
Diffstat (limited to 'getent.c')
-rw-r--r-- | getent.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; |