diff options
author | Florian Weimer <fweimer@redhat.com> | 2024-07-24 12:06:47 +0200 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2024-07-24 14:08:04 +0200 |
commit | 3da1b0064a6f730492340797c211d5fcd0a795bc (patch) | |
tree | 16af7ed07c3d21611edbd3ad5fdd14b188dbdc05 /resolv/tst-resolv-short-response.c | |
parent | 40a1e1798b2414c6ab32244b8cb03c2c39940b71 (diff) | |
download | glibc-3da1b0064a6f730492340797c211d5fcd0a795bc.tar.gz glibc-3da1b0064a6f730492340797c211d5fcd0a795bc.tar.xz glibc-3da1b0064a6f730492340797c211d5fcd0a795bc.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> (cherry picked from commit af625987d619388a100b153520d3ee308bda9889)
Diffstat (limited to 'resolv/tst-resolv-short-response.c')
-rw-r--r-- | resolv/tst-resolv-short-response.c | 12 |
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); } } |