[PATCH COMMITTED] nss_dns: Remove dead PTR IPv4-to-IPv6 mapping code
Florian Weimer
fweimer@redhat.com
Wed Sep 6 13:56:00 GMT 2017
On 09/06/2017 03:51 PM, Andreas Schwab wrote:
> On Sep 06 2017, Florian Weimer <fweimer@redhat.com> wrote:
>
>> On 09/06/2017 03:32 PM, Andreas Schwab wrote:
>>> On Sep 06 2017, fweimer@redhat.com (Florian Weimer) wrote:
>>>
>>>> Remove dead PTR IPv4-to-IPv6 mapping code from nss_dns.
>>>> * resolv/nss_dns/dns-host.c (getanswer_r): Remove dead code.
>>>
>>> In which way is that dead?
>>
>> if (type == T_A && qtype == T_AAAA && map)
>> have_to_map = 1;
>> else if (__glibc_unlikely (type != qtype))
>> {
>> cp += n;
>> continue; /* XXX - had_error++ ? */
>> }
>>
>> So have_to_map being true implies that qtype == T_AAAA. But this means
>> that after the if statement, type == T_A || type == T_AAAA. In
>> particular, type != T_PTR, which is why the have_to_map check is
>> superfluous.
>
> But it's inside a loop, and have_to_map is not reset.
And neither is qtype, which is why the type == T_A || type == T_AAAA
post-condition still holds.
Florian
More information about the Libc-alpha
mailing list