summaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/eventdns.c')
-rw-r--r--src/or/eventdns.c6
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)) {