Subject: Re: gethostname and getdomainname
To: None <tech-userlevel@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 11/13/1999 17:29:51
In article <19991113105648.B9785@jocelyn.rhein.de>,
Ignatios Souvatzis <is@jocelyn.rhein.de> wrote:
>
>Our manual page promises that a truncated name will not be null-terminated.
>SUSV2 specifies that a truncated name may or may not be null-terminated.
>
>I would like to make sysctl null-terminating, for the sake of robustness
>(The error is reported anyway, and this way, the returned truncated string
>is ready-to-use if the caller decides to do so).
Although this is a convenience issue, I'd rather it be non-null-terminated
for robustness:
- you lose one more byte of information
- if the program does not check the error code, then it'll
probably get into trouble and the bug will be apparent,
instead of hidden.
christos