Back to index

glibc  2.9
bug-ga2.c
Go to the documentation of this file.
00001 /* Test case by Sam Varshavchik <mrsam@courier-mta.com>.  */
00002 #include <mcheck.h>
00003 #include <netdb.h>
00004 #include <stdio.h>
00005 #include <string.h>
00006 
00007 int
00008 main (void)
00009 {
00010   struct addrinfo hints, *res;
00011   int i, ret;
00012 
00013   mtrace ();
00014   for (i = 0; i < 100; i++)
00015     {
00016       memset (&hints, 0, sizeof (hints));
00017       hints.ai_family = PF_UNSPEC;
00018       hints.ai_socktype = SOCK_STREAM;
00019 
00020       ret = getaddrinfo ("www.gnu.org", "http", &hints, &res);
00021 
00022       if (ret)
00023        {
00024          printf ("%s\n", gai_strerror (ret));
00025          return 1;
00026        }
00027       freeaddrinfo (res);
00028     }
00029   return 0;
00030 }