- ai_res = NULL;
- status = getaddrinfo (addr,
- port == NULL ? LCC_DEFAULT_PORT : port,
- &ai_hints, &ai_res);
- if (status != 0)
- {
- LCC_SET_ERRSTR (c, "getaddrinfo: %s", gai_strerror (status));
- return (-1);
+ struct addrinfo ai_hints = {.ai_family = AF_UNSPEC,
+ .ai_flags = AI_ADDRCONFIG,
+ .ai_socktype = SOCK_STREAM};
+
+ status = getaddrinfo(addr, port == NULL ? LCC_DEFAULT_PORT : port, &ai_hints,
+ &ai_res);
+ if (status != 0) {
+ LCC_SET_ERRSTR(c, "getaddrinfo: %s", gai_strerror(status));
+ return -1;