diff options
author | Denys Vlasenko | 2011-04-07 17:52:20 +0200 |
---|---|---|
committer | Denys Vlasenko | 2011-04-07 17:52:20 +0200 |
commit | ca18311d0ae16a96e988df15a9009095f93df85e (patch) | |
tree | 2122c871968c5239049c18b785c2ff27c6593f4f /libbb | |
parent | 8e23fafadee75bbe275bb795d0b2c2121dad93e7 (diff) | |
download | busybox-ca18311d0ae16a96e988df15a9009095f93df85e.zip busybox-ca18311d0ae16a96e988df15a9009095f93df85e.tar.gz |
libbb: make set_nport accept pointer to sockaddr, not to len_and_sockaddr.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/xconnect.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c index 127e2a5..4b7c110 100644 --- a/libbb/xconnect.c +++ b/libbb/xconnect.c @@ -134,16 +134,18 @@ int FAST_FUNC get_nport(const struct sockaddr *sa) return -1; } -void FAST_FUNC set_nport(len_and_sockaddr *lsa, unsigned port) +void FAST_FUNC set_nport(struct sockaddr *sa, unsigned port) { #if ENABLE_FEATURE_IPV6 - if (lsa->u.sa.sa_family == AF_INET6) { - lsa->u.sin6.sin6_port = port; + if (sa->sa_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (void*) sa; + sin6->sin6_port = port; return; } #endif - if (lsa->u.sa.sa_family == AF_INET) { - lsa->u.sin.sin_port = port; + if (sa->sa_family == AF_INET) { + struct sockaddr_in *sin = (void*) sa; + sin->sin_port = port; return; } /* What? UNIX socket? IPX?? :) */ @@ -283,7 +285,7 @@ IF_NOT_FEATURE_IPV6(sa_family_t af = AF_INET;) memcpy(&r->u.sa, used_res->ai_addr, used_res->ai_addrlen); set_port: - set_nport(r, htons(port)); + set_nport(&r->u.sa, htons(port)); ret: if (result) freeaddrinfo(result); @@ -369,7 +371,7 @@ static int create_and_bind_or_die(const char *bindaddr, int port, int sock_type) fd = xsocket(lsa->u.sa.sa_family, sock_type, 0); } else { fd = xsocket_type(&lsa, IF_FEATURE_IPV6(AF_UNSPEC,) sock_type); - set_nport(lsa, htons(port)); + set_nport(&lsa->u.sa, htons(port)); } setsockopt_reuseaddr(fd); xbind(fd, &lsa->u.sa, lsa->len); |