This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Test status before h_errno in gaih_inet
- From: Siddhesh Poyarekar <siddhesh at sourceware dot org>
- To: Stan Shebs <stanshebs at google dot com>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>
- Date: Mon, 29 Aug 2016 16:05:51 +0530
- Subject: Re: [PATCH] Test status before h_errno in gaih_inet
- Authentication-results: sourceware.org; auth=none
- References: <CA+5-Q5Kf3Eb5PYm9OusZ-JccCNgKMvLsM0GsnyKVBCD50m8Z8g@mail.gmail.com>
- Reply-to: siddhesh at sourceware dot org
On Monday 25 July 2016 10:20 PM, Stan Shebs wrote:
> The patch basically adds back a test that was previously
> present. I am not 100% convinced that it catches all cases
> of NSS status being set in a way that ought to be reported
> as an error coming from getaddrinfo, but I can't find
> any actual examples.
When I had changed this condition some time ago, my understanding was
that there are only two cases where h_errno is set to NETDB_INTERNAL:
when status is NSS_STATUS_UNAVAILABLE and when NSS_STATUS_TRYAGAIN. I
had dropped the status check as unnecessary (in multiple places IIRC)
because the NSS_STATUS_TRYAGAIN checks earlier was exhaustive. However,
I did not take into consideration the fact that h_errno will persist
across calls and hence removing that check was wrong.
Based on that, I agree with your fix is correct but it is incomplete.
There need to be similar checks for every place that test for h_errno ==
NETDB_INTERNAL, like in the gethosts macro and elsewhere in gaih_inet.
IIRC gethosts is exercised for AF_INET, so you might be able to verify
that with your test case.
Siddhesh