]> git.kaiwu.me - nginx.git/commitdiff
Core: guard use of AI_ADDRCONFIG.
authorRuslan Ermilov <ru@nginx.com>
Mon, 5 Aug 2013 09:44:56 +0000 (13:44 +0400)
committerRuslan Ermilov <ru@nginx.com>
Mon, 5 Aug 2013 09:44:56 +0000 (13:44 +0400)
Some systems (notably NetBSD and OpenBSD) lack AI_ADDRCONFIG support.

Reported by Piotr Sikora.

auto/unix
src/core/ngx_inet.c

index bc3c0f193c1488d4e1721660aa4e8a5d68262d3c..cd4209e7b2f18d1b82de3dab80192be935e7ae39 100755 (executable)
--- a/auto/unix
+++ b/auto/unix
@@ -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
index bb03720f70fc8791fe4c359b5d425fd817918001..0792d6e8ce582afeed01822b4db2b8ee3d0653b4 100644 (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";