diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-01-02 20:57:10 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-01-02 20:57:10 +0000 |
commit | 9c20441bcbf835ed45f5afcc1a8e52cc7dce2563 (patch) | |
tree | 2a58466e5d4391eff8e34c17dc158723c956bacf /src/common | |
parent | 89d268848f769f761f9cd128aa401c38ab470c74 (diff) | |
download | tor-9c20441bcbf835ed45f5afcc1a8e52cc7dce2563.tar.gz tor-9c20441bcbf835ed45f5afcc1a8e52cc7dce2563.zip |
Only set sin_len/sin6_len when they exist.
svn:r17851
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/address.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/address.c b/src/common/address.c index 1abd1a7dfb..2dd763da99 100644 --- a/src/common/address.c +++ b/src/common/address.c @@ -69,7 +69,9 @@ tor_addr_to_sockaddr(const tor_addr_t *a, return -1; sin = (struct sockaddr_in *)sa_out; memset(sin, 0, sizeof(struct sockaddr_in)); +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin->sin_len = sizeof(struct sockaddr_in); +#endif sin->sin_family = AF_INET; sin->sin_port = htons(port); sin->sin_addr.s_addr = tor_addr_to_ipv4n(a); @@ -80,7 +82,9 @@ tor_addr_to_sockaddr(const tor_addr_t *a, return -1; sin6 = (struct sockaddr_in6 *)sa_out; memset(sin6, 0, sizeof(struct sockaddr_in6)); +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN sin6->sin6_len = sizeof(struct sockaddr_in6); +#endif sin6->sin6_family = AF_INET6; sin6->sin6_port = htons(port); memcpy(&sin6->sin6_addr, tor_addr_to_in6(a), sizeof(struct in6_addr)); |