diff options
| author | Greg Hudson <ghudson@mit.edu> | 2014-06-07 16:25:35 -0400 |
|---|---|---|
| committer | Greg Hudson <ghudson@mit.edu> | 2014-06-27 19:36:39 -0400 |
| commit | 7567f36f83bab47206c2ea85724c1e74c26ec0d6 (patch) | |
| tree | 9f62179c57bfb1d3a3504f8fa8fa2fe4eca34518 /src/util/support | |
| parent | ddc1c61566cc5ececc5678088f0761ce2da61ee4 (diff) | |
| download | krb5-7567f36f83bab47206c2ea85724c1e74c26ec0d6.tar.gz krb5-7567f36f83bab47206c2ea85724c1e74c26ec0d6.tar.xz krb5-7567f36f83bab47206c2ea85724c1e74c26ec0d6.zip | |
Use sa_setport and sa_getport where appropriate
Use sa_setport and sa_getport in place of existing static helpers or
open-coded switch statements in net-server.c, fake-addrinfo.c, and
svc_tcp.c.
Diffstat (limited to 'src/util/support')
| -rw-r--r-- | src/util/support/fake-addrinfo.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c index 2129758c0..6ddf8593f 100644 --- a/src/util/support/fake-addrinfo.c +++ b/src/util/support/fake-addrinfo.c @@ -1145,7 +1145,7 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint, if (lport > 65535) return EAI_SOCKTYPE; service_is_numeric = 1; - service_port = htons(lport); + service_port = lport; #ifdef AI_NUMERICSERV if (hint && hint->ai_flags & AI_NUMERICSERV) serv = "9"; @@ -1281,14 +1281,7 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint, if (socket_type != 0 && ai->ai_socktype == 0) /* Is this check actually needed? */ ai->ai_socktype = socket_type; - switch (ai->ai_family) { - case AF_INET: - ((struct sockaddr_in *)ai->ai_addr)->sin_port = service_port; - break; - case AF_INET6: - ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port = service_port; - break; - } + sa_setport(ai->ai_addr, service_port); } } #endif |
