about summary refs log tree commit diff
path: root/resolv/tst-resolv-short-response.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2024-07-24 12:06:47 +0200
committerFlorian Weimer <fweimer@redhat.com>2024-07-24 12:07:24 +0200
commitaf625987d619388a100b153520d3ee308bda9889 (patch)
tree0beb50158d4d65c0e0e5911194c7ff039dfa62c3 /resolv/tst-resolv-short-response.c
parent691a3b2e9bfaba842e46a5ccb7f5e6ea144c3ade (diff)
downloadglibc-af625987d619388a100b153520d3ee308bda9889.tar.gz
glibc-af625987d619388a100b153520d3ee308bda9889.tar.xz
glibc-af625987d619388a100b153520d3ee308bda9889.zip
resolv: Do not wait for non-existing second DNS response after error (bug 30081)
In single-request mode, there is no second response after an error
because the second query has not been sent yet.  Waiting for it
introduces an unnecessary timeout.

Reviewed-by: DJ Delorie <dj@redhat.com>
Diffstat (limited to 'resolv/tst-resolv-short-response.c')
-rw-r--r--resolv/tst-resolv-short-response.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/resolv/tst-resolv-short-response.c b/resolv/tst-resolv-short-response.c
index cf1e39876f..be354ae1c7 100644
--- a/resolv/tst-resolv-short-response.c
+++ b/resolv/tst-resolv-short-response.c
@@ -81,6 +81,18 @@ check_one (void)
       check_hostent ("www.example", gethostbyname2 ("www.example", AF_INET6),
                      "name: www.example\n"
                      "address: 2001:db8::1\n");
+      static const struct addrinfo hints =
+        {
+          .ai_family = AF_UNSPEC,
+          .ai_socktype = SOCK_STREAM,
+        };
+      struct addrinfo *ai;
+      int ret = getaddrinfo ("www.example", "80", &hints, &ai);
+      check_addrinfo ("www.example", ai, ret,
+                      "address: STREAM/TCP 192.0.2.17 80\n"
+                      "address: STREAM/TCP 2001:db8::1 80\n");
+      if (ret == 0)
+        freeaddrinfo (ai);
     }
 }