[core] check if EAI_ADDRFAMILY is defined

(EAI_ADDRFAMILY is not available on FreeBSD)
personal/stbuehler/mod-csrf-old
Glenn Strauss 2016-07-29 12:48:00 -04:00
parent c8e647ad31
commit ad6d41896e
1 changed files with 5 additions and 1 deletions

View File

@ -282,7 +282,11 @@ static int network_server_init(server *srv, buffer *host_token, specific_config
if (0 != (r = getaddrinfo(host, NULL, &hints, &res))) {
hints.ai_family = AF_INET;
if (EAI_ADDRFAMILY == r && 0 == getaddrinfo(host, NULL, &hints, &res)) {
if (
#ifdef EAI_ADDRFAMILY
EAI_ADDRFAMILY == r &&
#endif
0 == getaddrinfo(host, NULL, &hints, &res)) {
memcpy(&srv_socket->addr.ipv4, res->ai_addr, res->ai_addrlen);
srv_socket->addr.ipv4.sin_family = AF_INET;
srv_socket->addr.ipv4.sin_port = htons(port);