Subject: Re: ares_init.c +1295, missing else?

Re: ares_init.c +1295, missing else?

From: Tommie Gannert <tommie_at_spotify.com>
Date: Tue, 22 Feb 2011 13:54:36 +0100

On 02/14/2011 08:10 PM, Dima Tisnek wrote:
> Sure, here it is:
>
> diff --git a/ares_init.c b/ares_init.c
> index d2f4a72..62e09b4 100644
> --- a/ares_init.c
> +++ b/ares_init.c
> @@ -1292,7 +1292,7 @@ static int config_sortlist(struct apattern
> **sortlist, int *nsort,
> if (!sortlist_alloc(sortlist, nsort,&pat))
> return ARES_ENOMEM;
> }
> - if (ipbufpfx[0]&&
> + else if (ipbufpfx[0]&&
> (bits = ares_inet_net_pton(AF_INET, ipbufpfx,&pat.addrV4,
> sizeof(pat.addrV4)))> 0)
> {

I agree it sounds reasonable only one of the branches in the loop
is executed. It's probably not an issue in practice as something can't
be parsed as both IPv6 and IPv4 (right?)

-- 
Tommie Gannert
Received on 2011-02-22