mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-15 15:40:12 +00:00
5605e1177d
2004-02-23 Jakub Jelinek <jakub@redhat.com> * sysdeps/posix/getaddrinfo.c (gaih_inet): If _res has not been inited yet, try to init it before saving old _res.options. * posix/Makefile (xtests): Add bug-ga2. (generated): Add bug-ga2.mtrace and bug-ga2-mem. (xtests): Depend on bug-ga2-mem. ($(objpfx)bug-ga2-mem, bug-ga2-ENV): New. * posix/bug-ga2.c: New test.
31 lines
552 B
C
31 lines
552 B
C
/* 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;
|
|
}
|