summaryrefslogtreecommitdiff
path: root/posix/bug-ga2.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-23 19:54:06 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-23 19:54:06 +0000
commit5605e1177d4728b66b92cb5012810b5feda1ec4b (patch)
treeb65a493bf9b40bb2291d96739c59e01eb392e10d /posix/bug-ga2.c
parenta8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83 (diff)
Update.
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.
Diffstat (limited to 'posix/bug-ga2.c')
-rw-r--r--posix/bug-ga2.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/posix/bug-ga2.c b/posix/bug-ga2.c
new file mode 100644
index 0000000000..5ea759b8ce
--- /dev/null
+++ b/posix/bug-ga2.c
@@ -0,0 +1,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;
+}