mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +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
fc263d245a
commit
78a8a7a4a3
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
|
* Source/UnixFileHandle.m: Tidy a little and make sure that
|
||||||
non-blocking mode is reset when a descriptor is closed.
|
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>
|
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)
|
if (name == nil)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[NSException raise: NSInvalidArgumentException
|
||||||
format: @"attempt to register port with nil name"];
|
format: @"attempt to lookup port with nil name"];
|
||||||
}
|
}
|
||||||
|
|
||||||
len = [name cStringLength];
|
len = [name cStringLength];
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
{
|
{
|
||||||
[NSException raise: NSInvalidArgumentException
|
[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)
|
if (len > GDO_NAME_MAX_LEN)
|
||||||
{
|
{
|
||||||
|
@ -179,7 +179,19 @@ static NSPortNameServer *defaultServer = nil;
|
||||||
GDO_NAME_MAX_LEN];
|
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;
|
NSMutableData *tmp;
|
||||||
unsigned bufsiz;
|
unsigned bufsiz;
|
||||||
|
@ -281,14 +293,19 @@ static NSPortNameServer *defaultServer = nil;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
NSHost *h;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Query a single nameserver - on the local host.
|
* Query a single nameserver - on the specified host.
|
||||||
*/
|
*/
|
||||||
numSvrs = 1;
|
numSvrs = 1;
|
||||||
|
h = [NSHost hostWithName: host];
|
||||||
|
if (h)
|
||||||
|
host = [h address];
|
||||||
#ifndef HAVE_INET_ATON
|
#ifndef HAVE_INET_ATON
|
||||||
svrs->s_addr = inet_addr("127.0.0.1");
|
svrs->s_addr = inet_addr([host cString]);
|
||||||
#else
|
#else
|
||||||
inet_aton("127.0.0.1", (struct in_addr *)&svrs->s_addr);
|
inet_aton([host cString], (struct in_addr *)&svrs->s_addr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue