Re: gethostbyname() and resolv.conf updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/17/2010 05:41 PM, Bernie Innocenti wrote:
> Hello,
>
> xchat in Fedora needs to be restarted after switching to a different
> nameserver or it fails to resolve.
>
> The xchat developers say that all xchat does is call gethostbyname(). A
> Debian user told me that Debian carries a glibc patch to make processes
> notice resolv.conf updates and reload it.
>
> Is there any chance we could apply the same patch in Fedora too? I don't
> know all the details, but I guess there might be a good reason why this
> patch wasn't upstreamed yet.
>

This is the entire purpose of the res_init() function in glibc. If your 
application needs to be aware of a change in resolv.conf, you should be 
monitoring it with inotify and calling res_init() anytime the file is 
changed.

I disagree that this is necessarily a bug in glibc, as it allows the 
application writer to decide for themselves whether to trust a change to 
resolv.conf mid-operation.

The easy fix in xchat would be to simply call res_init() immediately 
before calling gethostbyname(). It would add a small amount of overhead 
to hostname lookups, but it would always work. Monitoring resolv.conf 
for changes would be an optimization, of course.

-- 
Stephen Gallagher
RHCE 804006346421761

Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux