This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308)
- From: Andreas Schwab <schwab at suse dot de>
- To: Siddhesh Poyarekar <siddhesh at redhat dot com>
- Cc: carlos at redhat dot com, libc-alpha at sourceware dot org
- Date: Tue, 08 Jul 2014 11:43:41 +0200
- Subject: Re: [PATCH] Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308)
- Authentication-results: sourceware.org; auth=none
- References: <20140415162902 dot GA8469 at spoyarek dot pnq dot redhat dot com>
Siddhesh Poyarekar <siddhesh@redhat.com> writes:
> diff --git a/resolv/res_query.c b/resolv/res_query.c
> index a9db837..4e6612c 100644
> --- a/resolv/res_query.c
> +++ b/resolv/res_query.c
> @@ -382,7 +382,9 @@ __libc_res_nsearch(res_state statp,
> answer, anslen, answerp,
> answerp2, nanswerp2, resplen2,
> answerp2_malloced);
> - if (ret > 0 || trailing_dot)
> + if (ret > 0 || trailing_dot
> + /* If the second response is valid then we use that. */
> + || (ret == 0 && answerp2 != NULL && resplen2 > 0))
That doesn't make sense, resplen2 is a pointer. I'm surprised that the
compiler does not warn about that.
I think that answerp2 != NULL should be resplen2 != NULL.
> @@ -422,7 +424,8 @@ __libc_res_nsearch(res_state statp,
> answer, anslen, answerp,
> answerp2, nanswerp2,
> resplen2, answerp2_malloced);
> - if (ret > 0)
> + if (ret > 0 || (ret == 0 && answerp2 != NULL
> + && resplen2 > 0))
Likewise.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."