mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Fix error in lookup of named host
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4640 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
395af5f397
commit
430bc959e2
2 changed files with 26 additions and 7 deletions
|
@ -1,7 +1,9 @@
|
|||
Fri Jul 23 21:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
Fri Jul 23 22:20:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/UnixFileHandle.m: Tidy a little and make sure that
|
||||
non-blocking mode is reset when a descriptor is closed.
|
||||
* Source/NSPortNameServer.mL Fixed error in lookup when host name
|
||||
is specified.
|
||||
|
||||
Thu Jul 22 13:55:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
|
|
|
@ -163,14 +163,14 @@ static NSPortNameServer *defaultServer = nil;
|
|||
if (name == nil)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register port with nil name"];
|
||||
format: @"attempt to lookup port with nil name"];
|
||||
}
|
||||
|
||||
len = [name cStringLength];
|
||||
if (len == 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"attempt to register port with no name"];
|
||||
format: @"attempt to lookup port with no name"];
|
||||
}
|
||||
if (len > GDO_NAME_MAX_LEN)
|
||||
{
|
||||
|
@ -179,7 +179,19 @@ static NSPortNameServer *defaultServer = nil;
|
|||
GDO_NAME_MAX_LEN];
|
||||
}
|
||||
|
||||
if (host != nil && [host isEqual: @"*"])
|
||||
if (host == nil || [host isEqual: @""])
|
||||
{
|
||||
/*
|
||||
* Query a single nameserver - on the local host.
|
||||
*/
|
||||
numSvrs = 1;
|
||||
#ifndef HAVE_INET_ATON
|
||||
svrs->s_addr = inet_addr("127.0.0.1");
|
||||
#else
|
||||
inet_aton("127.0.0.1", (struct in_addr *)&svrs->s_addr);
|
||||
#endif
|
||||
}
|
||||
else if ([host isEqual: @"*"])
|
||||
{
|
||||
NSMutableData *tmp;
|
||||
unsigned bufsiz;
|
||||
|
@ -281,14 +293,19 @@ static NSPortNameServer *defaultServer = nil;
|
|||
}
|
||||
else
|
||||
{
|
||||
NSHost *h;
|
||||
|
||||
/*
|
||||
* Query a single nameserver - on the local host.
|
||||
* Query a single nameserver - on the specified host.
|
||||
*/
|
||||
numSvrs = 1;
|
||||
h = [NSHost hostWithName: host];
|
||||
if (h)
|
||||
host = [h address];
|
||||
#ifndef HAVE_INET_ATON
|
||||
svrs->s_addr = inet_addr("127.0.0.1");
|
||||
svrs->s_addr = inet_addr([host cString]);
|
||||
#else
|
||||
inet_aton("127.0.0.1", (struct in_addr *)&svrs->s_addr);
|
||||
inet_aton([host cString], (struct in_addr *)&svrs->s_addr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue