On 30/04/19(Tue) 15:41, Ted Unangst wrote: > Martin Pieuchot wrote: > > When my machine doesn't get a reply from a DNS server, generally the > > wifi router of the place where I'm drinking coffee, applications sit > > in gethostbyname(3) "indefinitely". At least too long for me to wait > > and I end up killing the app. > > We used to add an entry for the machine's hostname to /etc/hosts, but this > lead to other problems and was removed some years ago I believe. > > Personally, I think it's a likely bug for software to resolve local hostname. > You already know the hostname, it's just gethostname(), and if you really need > to know the IP, it's in ifconfig, etc., but there's no reason to believe > there's only one IP or that other machines will know that this system has this > name.
I see it differently. If the interface is down the problem doesn't exist. In other words, should gethostbyname(3) block? This problem can also be seen when opening a new tab in a browser.
