[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [patches] [bug] when /etc/hosts doesn't exist, apt fails to resolve hostnames using libc6 2.10.1
- To: patches@xxxxxxxxxx
- Subject: Re: [patches] [bug] when /etc/hosts doesn't exist, apt fails to resolve hostnames using libc6 2.10.1
- From: Steve Langasek <steve.langasek@xxxxxxxxxx>
- Date: Tue, 11 Aug 2009 12:25:40 -0700
On Wed, Aug 5, 2009 at 14:35:26 +0200, Aurelien Jarno wrote:
> The patch below should fix this problem:
> diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c
> index 7b69d47..e6e4576 100644
> --- a/nss/nss_files/files-hosts.c
> +++ b/nss/nss_files/files-hosts.c
> @@ -423,6 +423,11 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat,
> if (! keep_stream)
> internal_endent ();
> }
> + else
> + {
> + *errnop = errno;
> + *herrnop = NETDB_INTERNAL;
> + }
>
> __libc_lock_unlock (lock);
>
In testing here, it appears that NETDB_INTERNAL is not the correct herrno to
set - at least, getaddrinfo() interprets this as a system failure. Setting
it to NO_DATA instead is sufficient to get getaddrinfo() working here with a
missing /etc/hosts.
It also seems like the logical value to return, so I don't imagine this will
introduce regressions, but I haven't tested very extensively yet.
Cheers,
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek@xxxxxxxxxx vorlon@xxxxxxxxxx