Use inet_aton() where available

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5247 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-11-21 06:39:35 +00:00
parent 9e3c780110
commit a1e4758abf
2 changed files with 9 additions and 2 deletions

View file

@ -204,12 +204,18 @@ static NSMutableDictionary*_hostCache = nil;
NSLog(@"Nil address sent to +[NSHost hostWithAddress]");
return nil;
}
hostaddr.s_addr = inet_addr((char*)[address cString]);
#ifndef HAVE_INET_ATON
hostaddr.s_addr = inet_addr([address cString]);
if (hostaddr.s_addr == -1)
{
return nil;
}
#else
if (inet_aton([address cString], &hostaddr.s_addr) == 0)
{
return nil;
}
#endif
h = gethostbyaddr((char*)&hostaddr, sizeof(hostaddr), AF_INET);
return [self _hostWithHostEntry: h];