[PATCH] Core: guard use of AI_ADDRCONFIG
Piotr Sikora
piotr at cloudflare.com
Mon Aug 5 07:45:11 UTC 2013
# HG changeset patch
# User Piotr Sikora <piotr at cloudflare.com>
# Date 1375688648 0
# Mon Aug 05 07:44:08 2013 +0000
# Node ID c9e0a2f54810335ba91b86fdb92ef63571680dae
# Parent ec8594b9bf11de3599af15de8e73e41bf7a8b42c
Core: guard use of AI_ADDRCONFIG.
AI_ADDRCONFIG is not available on all operating systems (e.g. OpenBSD)
and using it without a guard results in dropped getaddrinfo() support.
Signed-off-by: Piotr Sikora <piotr at cloudflare.com>
diff -r ec8594b9bf11 -r c9e0a2f54810 auto/unix
--- a/auto/unix Mon Aug 05 10:55:59 2013 +0400
+++ b/auto/unix Mon Aug 05 07:44:08 2013 +0000
@@ -791,7 +791,9 @@ ngx_feature_libs=
ngx_feature_test='struct addrinfo hints, *res;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
+ #ifdef AI_ADDRCONFIG
hints.ai_flags = AI_ADDRCONFIG;
+ #endif
if (getaddrinfo("localhost", NULL, &hints, &res) != 0)
return 1;
freeaddrinfo(res)'
diff -r ec8594b9bf11 -r c9e0a2f54810 src/core/ngx_inet.c
--- a/src/core/ngx_inet.c Mon Aug 05 10:55:59 2013 +0400
+++ b/src/core/ngx_inet.c Mon Aug 05 07:44:08 2013 +0000
@@ -963,7 +963,9 @@ ngx_inet_resolve_host(ngx_pool_t *pool,
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";
More information about the nginx-devel
mailing list