Re: Showstopping bug: gethostname() behaving incorrectly
On Wed, Feb 09, 2000 at 11:06:11PM -0700, Randolph Chung wrote:
> There has been some debate about whether the fqdn should go into
> /etc/hostname; however, if programs need to get a fqdn, the correct way to
> do it seems to be to first do a gethostname() call followed by a
> gethostbyname() call to retrieve the real FQDN. That's how "hostname -f"
> works iirc.
Hmm -- what if your default search domain in (/etc/resolve.conf) was not
your host's domain? gethostbyname() could end up looking up a different
host entirely, and then you get the wrong domain back. That would be
a bizarre setup but legal I think.
Hamish
--
Hamish Moffatt VK3SB. CCs of replies on mailing lists are welcome.
Reply to: