hints.ai_addr = NULL;
hints.ai_canonname = NULL;
hints.ai_next = NULL;
- err = getaddrinfo(host, NULL, NULL, &ret->ai);
+ err = getaddrinfo(host, NULL, &hints, &ret->ai);
if (err != 0) {
ret->error = gai_strerror(err);
return ret;
ret->family = AF_UNSPEC;
strncpy(ret->hostname, host, lenof(ret->hostname));
ret->hostname[lenof(ret->hostname)-1] = '\0';
+#ifndef NO_IPV6
+ ret->ai = NULL;
+#endif
return ret;
}