Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Oct 2005 11:31:24 +0100
From:      Ceri Davies <ceri@submonkey.net>
To:        Brooks Davis <brooks@one-eyed-alien.net>
Cc:        arch@freebsd.org
Subject:   Re: error in trimdomain(3)
Message-ID:  <20051003103124.GB56760@submonkey.net>
In-Reply-To: <20051001093550.GA32354@odin.ac.hmc.edu>
References:  <20051001093550.GA32354@odin.ac.hmc.edu>

next in thread | previous in thread | raw e-mail | index | archive | help

--UlVJffcvxoiEqYs2
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Oct 01, 2005 at 02:35:50AM -0700, Brooks Davis wrote:
> I discovered today that the trimdomain() implementation in libutil deviat=
es
> slightly from the manpage.  The manpage says:
>=20
>      The function trimdomain() removes the current domain name from the p=
assed
>      fullhost name by writing a NUL character over the first period of the
>                                                        ^^^^^^^^^^^^
>      passed name.  The current domain name is determined by calling
>      gethostname(3) and removing everything up to the first period.
>=20
> which clearly indicates that trimdomain() should return either the
> unmodified string or a host name with no domain.  In reality it will
> remove the domain name even if the result is not a host name.  This
> means that if the host b.com calls trimdomain with "a.b.com" as the
> input string, the result is "a.b".

That's actually what the excerpt above says will happen.

gethostname returns "b.com", removing everything up to the first period
yields ".com", and that removed from "a.b.com" gives you "a.b".

I don't care if it needs to be changed, but that does exactly what it
says on the tin so far as I can see.

Ceri
--=20
Only two things are infinite, the universe and human stupidity, and I'm
not sure about the former.			  -- Einstein (attrib.)

--UlVJffcvxoiEqYs2
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (FreeBSD)

iD8DBQFDQQh8ocfcwTS3JF8RAtK+AJ9YjN2KjZmoMesWmHKS3qD+5WkGMQCgs1VO
dUe2NAsrjlRKnaICsxjCdC0=
=F4fV
-----END PGP SIGNATURE-----

--UlVJffcvxoiEqYs2--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20051003103124.GB56760>