mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +00:00
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:
parent
9e3c780110
commit
a1e4758abf
2 changed files with 9 additions and 2 deletions
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue