use less than full length of buffer with gethostname in case there are errors in the implementation of gethostname

This commit is contained in:
Jeff Hill
2004-10-08 15:37:34 +00:00
parent 1bb5a5d86b
commit f5803beb8a

View File

@@ -30,7 +30,7 @@ localHostName::localHostName ()
int status = osiSockAttach ();
if ( status ) {
this->attachedToSockLib = true;
status = gethostname ( this->cache, sizeof ( this->cache ) );
status = gethostname ( this->cache, sizeof ( this->cache ) - 1 );
if ( status ) {
strncpy ( this->cache, "<unknown host>", sizeof ( this->cache ) );
}