Browse code

better fix

git-svn: trunk@4199

Tomasz Kojm authored on 2008/09/23 06:35:29
Showing 3 changed files
... ...
@@ -1,6 +1,6 @@
1 1
 Mon Sep 22 23:38:16 CEST 2008 (tk)
2 2
 ----------------------------------
3
-  * configure: use AF_UNSPEC when testing getaddrinfo() (bb#1196)
3
+  * configure: use AF_UNSPEC when testing getaddrinfo()/IPv6 support (bb#1196)
4 4
 
5 5
 Thu Sep 18 12:13:56 CEST 2008 (tk)
6 6
 ----------------------------------
... ...
@@ -16230,12 +16230,10 @@ cat >>conftest.$ac_ext <<_ACEOF
16230 16230
 		    #include <unistd.h>
16231 16231
 		    int main(int argc, char **argv)
16232 16232
 		    {
16233
-			    struct addrinfo *res, hints;
16233
+			    struct addrinfo *res;
16234 16234
 			    int sd;
16235 16235
 
16236
-			memset(&hints, 0, sizeof(hints));
16237
-			hints.ai_family = AF_UNSPEC;
16238
-			if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
16236
+			if(getaddrinfo("127.0.0.1", NULL, NULL, &res) < 0)
16239 16237
 			    return 1;
16240 16238
 			freeaddrinfo(res);
16241 16239
 
... ...
@@ -16322,14 +16320,22 @@ cat >>conftest.$ac_ext <<_ACEOF
16322 16322
 
16323 16323
 		    #include <sys/types.h>
16324 16324
 		    #include <sys/socket.h>
16325
+		    #include <netdb.h>
16325 16326
 		    #include <unistd.h>
16326 16327
 		    int main(int argc, char **argv)
16327 16328
 		    {
16329
+			    struct addrinfo *res, hints;
16328 16330
 			    int sd;
16329 16331
 
16330 16332
 			if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
16331 16333
 			    return 1;
16332 16334
 			close(sd);
16335
+			/* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
16336
+			memset(&hints, 0, sizeof(hints));
16337
+			hints.ai_family = AF_UNSPEC;
16338
+			if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
16339
+			    return 1;
16340
+			freeaddrinfo(res);
16333 16341
 			return 0;
16334 16342
 		    }
16335 16343
 
... ...
@@ -481,12 +481,10 @@ then
481 481
 		    #include <unistd.h>
482 482
 		    int main(int argc, char **argv)
483 483
 		    {
484
-			    struct addrinfo *res, hints;
484
+			    struct addrinfo *res;
485 485
 			    int sd;
486 486
 
487
-			memset(&hints, 0, sizeof(hints));
488
-			hints.ai_family = AF_UNSPEC;
489
-			if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
487
+			if(getaddrinfo("127.0.0.1", NULL, NULL, &res) < 0)
490 488
 			    return 1;
491 489
 			freeaddrinfo(res);
492 490
 
... ...
@@ -513,14 +511,22 @@ then
513 513
 		AC_TRY_RUN([
514 514
 		    #include <sys/types.h>
515 515
 		    #include <sys/socket.h>
516
+		    #include <netdb.h>
516 517
 		    #include <unistd.h>
517 518
 		    int main(int argc, char **argv)
518 519
 		    {
520
+			    struct addrinfo *res, hints;
519 521
 			    int sd;
520 522
 
521 523
 			if((sd = socket(AF_INET6, SOCK_STREAM, 0)) < 0)
522 524
 			    return 1;
523 525
 			close(sd);
526
+			/* also check if getaddrinfo() handles AF_UNSPEC -- bb#1196 */
527
+			memset(&hints, 0, sizeof(hints));
528
+			hints.ai_family = AF_UNSPEC;
529
+			if(getaddrinfo("127.0.0.1", NULL, &hints, &res) < 0)
530
+			    return 1;
531
+			freeaddrinfo(res);
524 532
 			return 0;
525 533
 		    }
526 534
 		],