Core: guard use of AI_ADDRCONFIG.

Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support.

Reported by Piotr Sikora.
This commit is contained in:
Ruslan Ermilov 2013-08-05 13:44:56 +04:00
parent 4d1b08bb1c
commit 3693daa20f
2 changed files with 4 additions and 6 deletions

View File

@ -788,11 +788,7 @@ ngx_feature_incs="#include <sys/types.h>
#include <netdb.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='struct addrinfo hints, *res;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_ADDRCONFIG;
if (getaddrinfo("localhost", NULL, &hints, &res) != 0)
return 1;
ngx_feature_test='struct addrinfo *res;
if (getaddrinfo("localhost", NULL, NULL, &res) != 0) return 1;
freeaddrinfo(res)'
. auto/feature

View File

@ -963,7 +963,9 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
ngx_memzero(&hints, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
#ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
#endif
if (getaddrinfo((char *) host, NULL, &hints, &res) != 0) {
u->err = "host not found";