Subject: Re: gethostname and getdomainname
To: Christos Zoulas <firstname.lastname@example.org>
From: Ignatios Souvatzis <email@example.com>
Date: 11/14/1999 08:23:20
On Sat, Nov 13, 1999 at 10:23:41PM -0500, Christos Zoulas wrote:
> | Would this really help?
> I see your point, but the issue is that since gethostname is not guaranteed
> to return a null terminated string, the code should be checking anyway.
> We are developing a portable operating system, and it is a bit against
> our philosophy to band-aid routines so that badly written code works.
Uhm... checking the return code won't help for portable programs....
neither SUSV2 nor Solaris document that an error return happens if the
name is truncated, and the errno value for this condition.
(We dont do it, either).
So our gethostname() would need to _silently_ non-Null-terminate?
OS man:terminate man:errno does:terminate err/errno
SUSV2 maybe - n/a n/a
Solaris no - yes 0/no
SunOS no - yes 0/no
Ultrix no - yes 0/no
DU4.0 maybe - yes 0/no
Parix no man page ? no 1/0
(in man:terminate, I counted as "no" occurences of "null-terminated unless the
provided buffer is not sufficient". I counted as "maybe": "if enough space
is provided, the name is null-terminated".)
(Parix is breandead in that it returns 1 even when it didn't truncate