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/or/eventdns.c | |
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/or/eventdns.c')
-rw-r--r-- | src/or/eventdns.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 248422d22a..6b61758210 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -2302,7 +2302,9 @@ evdns_nameserver_add(unsigned long int address) { struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin.sin_len = sizeof(sin); +#endif sin.sin_addr.s_addr = htonl(address); sin.sin_port = 53; return _evdns_nameserver_add_impl((struct sockaddr*) &sin, sizeof(sin)); @@ -2381,7 +2383,9 @@ evdns_nameserver_ip_add(const char *ip_as_string) { if (is_ipv6) { struct sockaddr_in6 sin6; memset(&sin6, 0, sizeof(sin6)); +#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN sin6.sin6_len = sizeof(sin6); +#endif sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(port); if (1 != tor_inet_pton(AF_INET6, addr_part, &sin6.sin6_addr)) { @@ -2393,7 +2397,9 @@ evdns_nameserver_ip_add(const char *ip_as_string) { } else { struct sockaddr_in sin; memset(&sin, 0, sizeof(sin)); +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN sin.sin_len = sizeof(sin); +#endif sin.sin_family = AF_INET; sin.sin_port = htons(port); if (!inet_aton(addr_part, &sin.sin_addr)) { |