On Wed, 17 Jun 1998, Marc Evelyn wrote:

> On Wed, 17 Jun 1998, Christopher Seawood wrote:
> 
>  # Yes, this does seem to be a glibc bug.  The attached code is the gist of
>  # getLocalHost().  It returns the correct result on my machine at work
>  # running glibc 2.0.6 but returns the first entry in /etc/hosts on my
>  # machine at home running redhat's glibc 2.0.7-13.  
>  #
> 
> That code (getlocalhost.c) works fine here:
> 
> Red Hat 5.0, 2.0.34, 2.0.7-13, and the first entry in /etc/hosts is
> 'localhost' (127.0.0.1)
> 
> 19:33:45 (mast)$ gcc getlocalhost.c 
> 19:42:50 (mast)$ ./a.out 
> Hostname: mast.interlog.com

After some further testing, diz & I discovered that getlocalhost will
work properly if:
    1) /etc/hosts does not contain an entry for your machine 
or  2) the /etc/nsswitch.conf hosts line has dns before files

- cls


Reply via email to