Minor fixes to use of local hostname.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20112 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2004-09-23 08:19:29 +00:00
parent 818d069663
commit a2c67aa163
2 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2004-09-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSHost.m: Use isEqualToString rather than == to test for
the special local host name. Fix check for nil hostname in
([_initWithHostEntry:key:])
2004-09-21 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSConnection.m: ([_getReplyRmc:]) improve timeout code.

View file

@ -146,14 +146,15 @@ static NSMutableDictionary *_hostCache = nil;
{
return nil;
}
if (name != localHostName && entry == (struct hostent*)NULL)
if ([name isEqualToString: localHostName] == NO
&& entry == (struct hostent*)NULL)
{
NSLog(@"Host '%@' init failed - perhaps the name/address is wrong or "
@"networking is not set up on your machine", name);
RELEASE(self);
return nil;
}
else if (localHostName == nil && entry != (struct hostent*)NULL)
else if (name == nil && entry != (struct hostent*)NULL)
{
NSLog(@"Nil hostname supplied but network database entry is not empty");
RELEASE(self);
@ -163,7 +164,7 @@ static NSMutableDictionary *_hostCache = nil;
names = [NSMutableSet new];
addresses = [NSMutableSet new];
if (name == localHostName)
if ([name isEqualToString: localHostName] == YES)
{
extra = [hostClass _localAddresses];
}
@ -325,13 +326,13 @@ myHostName()
}
if (host == nil)
{
if (name == localHostName)
if ([name isEqualToString: localHostName] == YES)
{
/*
* Special GNUstep extension host - we try to have a host entry
* with ALL the IP addresses of any interfaces on the local machine
*/
host = [[self alloc] _initWithHostEntry: 0 key: name];
host = [[self alloc] _initWithHostEntry: 0 key: localHostName];
AUTORELEASE(host);
}
else