aboutsummaryrefslogtreecommitdiff
path: root/posix/bug-ga2.c
blob: 5ea759b8ce13fa22883ba5f137d5adcccb738283 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* Test case by Sam Varshavchik <mrsam@courier-mta.com>.  */
#include <mcheck.h>
#include <netdb.h>
#include <stdio.h>
#include <string.h>

int
main (void)
{
  struct addrinfo hints, *res;
  int i, ret;

  mtrace ();
  for (i = 0; i < 100; i++)
    {
      memset (&hints, 0, sizeof (hints));
      hints.ai_family = PF_UNSPEC;
      hints.ai_socktype = SOCK_STREAM;

      ret = getaddrinfo ("www.gnu.org", "http", &hints, &res);

      if (ret)
	{
	  printf ("%s\n", gai_strerror (ret));
	  return 1;
	}
      freeaddrinfo (res);
    }
  return 0;
}