This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Do not fail if one of the two responses to AF_UNSPEC fails (BZ #14308)


Forgot one detail:

2014-04-16  Siddhesh Poyarekar  <siddhesh@redhat.com>
	    Atsushi Onoe  <atsushi@onoe.org>
> 
> 	[BZ #14308]
> 	* resolv/res_query.c (__libc_res_nsearch): Return if at least
> 	one response is valid.
> 	* resolv/res_send.c (send_dg): Check for validity of other
> 	response if the current response is a referral.
> 
> ---
>  resolv/res_query.c | 7 +++++--
>  resolv/res_send.c  | 2 +-
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> 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))
>  			return (ret);
>  		saved_herrno = h_errno;
>  		tried_as_is++;
> @@ -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))
>  				return (ret);
>  
>  			if (answerp && *answerp != answer) {
> diff --git a/resolv/res_send.c b/resolv/res_send.c
> index 60743df..3273d55 100644
> --- a/resolv/res_send.c
> +++ b/resolv/res_send.c
> @@ -1351,6 +1351,7 @@ send_dg(res_state statp,
>  				(*thisresplenp > *thisanssizp)
>  				? *thisanssizp : *thisresplenp);
>  
> +		next_ns:
>  			if (recvresp1 || (buf2 != NULL && recvresp2)) {
>  			  *resplen2 = 0;
>  			  return resplen;
> @@ -1368,7 +1369,6 @@ send_dg(res_state statp,
>  			    goto wait;
>  			  }
>  
> -		next_ns:
>  			__res_iclose(statp, false);
>  			/* don't retry if called from dig */
>  			if (!statp->pfcode)
> -- 
> 1.8.3.1
> 


Attachment: pgpjfyvSlxaq0.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]