Subject: Re: gethostname and getdomainname
To: Christos Zoulas <christos@zoulas.com>
From: Ignatios Souvatzis <is@jocelyn.rhein.de>
List: tech-userlevel
Date: 11/14/1999 21:29:10
On Sun, Nov 14, 1999 at 08:42:16AM -0500, Christos Zoulas wrote:
>
> Solaris claims that the return buffer is not null terminated, but then
> goes ahead and null terminates it :-)
Note that it does NOT return an error in this case, which still makes us
different from it (and SunOS4, and Ultrix, and DU4) if we follow this
suggestion:
> Ok. I suppose then that it is better to null terminate the buffer in
> gethostname() and return an error.
I really think we should also swallow the error there.
> I still think though that it is better
> to make sysctl return a non-null-terminated string.
Thats fine with me.
To summarize, I would
- fix sysctl so that it returns the truncated string, non-null-terminated,
and create an appropriate error. I think copyoutstr will do the job nicely
for us.
- fix gethostname/getdomainname so that if ENAMETOOLONG is returned from the
above, it will restore the old errno and null terminate the string
Regards,
Ignatios