Fixes for maxhostnamelen - all use NSHost.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5113 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-10-31 09:48:26 +00:00
parent 6b14ba31f0
commit 6993fe84f7
4 changed files with 22 additions and 58 deletions

View file

@ -148,17 +148,23 @@ static NSMutableDictionary*_hostCache = nil;
}
}
/*
* Max hostname length in line with RFC 1123
*/
#define GSMAXHOSTNAMELEN 255
+ (NSHost*) currentHost
{
char name[MAXHOSTNAMELEN];
int res;
struct hostent*h;
char name[GSMAXHOSTNAMELEN+1];
int res;
struct hostent *h;
res = gethostname(name, sizeof(name));
res = gethostname(name, GSMAXHOSTNAMELEN);
if (res < 0)
{
return nil;
}
name[GSMAXHOSTNAMELEN] = '\0';
h = gethostbyname(name);
if (h == NULL)