[PATCH] Test status before h_errno in gaih_inet
Siddhesh Poyarekar
siddhesh@sourceware.org
Mon Aug 29 10:35:00 GMT 2016
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
More information about the Libc-alpha
mailing list