On Mon, Jan 13, 2014 at 09:36:03AM +0000, Stuart Henderson wrote:
> On 2014-01-12, Riccardo Mottola <riccardo.mott...@libero.it> wrote:

> You must use libbind's headers, too: -I/usr/local/include/libbind
> 
> It would probably make sense to apply the diff suggested in that thread
> though, as it fixes this case and I don't see a downside (it isn't enough
> for some programs which grovel deeper in struct _res, e.g. mtr, but it
> seems it fixes enough common cases to be useful).
> 
> Here's a complete diff including tedu's suggestion.
> Eric, what do you think?

I can't test right now, but it looks ok. However, note that the entries
will not be updated on resolv.conf change, unless the caller resets the
RES_INIT flag.

If it fixes the issue it can go in.

Eric.

> 
> Index: asr/res_init.c
> ===================================================================
> RCS file: /cvs/src/lib/libc/asr/res_init.c,v
> retrieving revision 1.2
> diff -u -p -r1.2 res_init.c
> --- asr/res_init.c    27 May 2013 17:31:01 -0000      1.2
> +++ asr/res_init.c    13 Jan 2014 09:18:57 -0000
> @@ -37,6 +37,7 @@ res_init(void)
>  {
>       _THREAD_PRIVATE_MUTEX(init);
>       struct asr_ctx  *ac;
> +     int i;
>  
>       ac = asr_use_resolver(NULL);
>  
> @@ -55,6 +56,10 @@ res_init(void)
>                       strlcpy(_res.lookups, ac->ac_db, sizeof(_res.lookups));
>  
>               _res.nscount = ac->ac_nscount;
> +             for (i = 0; i < ac->ac_nscount; i++) {
> +                     memcpy(&_res.nsaddr_list[i], ac->ac_ns[i],
> +                         ac->ac_ns[i]->sa_len);
> +             }
>               _res.options |= RES_INIT;
>       }
>       _THREAD_PRIVATE_MUTEX_UNLOCK(init);

Reply via email to