mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
6b14ba31f0
commit
6993fe84f7
4 changed files with 22 additions and 58 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue