More patches from Frith-MacDonald.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@2708 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 1998-01-21 20:08:58 +00:00
parent 9f92fd9cfe
commit 4959cde7e5
3 changed files with 36 additions and 4 deletions

View file

@ -1,3 +1,12 @@
Wed Jan 21 17:37:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Tools/defaults.m: Fixed bug in handling 'write' operations reading
info from stdin - now puts all values into the database correctly.
* src/TcpPort.m: ([+newForReceivingFromPortNumber:]) added code to
perform retries if the kernel freaks out when asked to select the
port to bind to - this has happened to me on linux!
Wed Jan 21 11:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk> Wed Jan 21 11:45:00 1998 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* src/GetDefEncoding.m: Modified GetDefEncoding() to us the NSString * src/GetDefEncoding.m: Modified GetDefEncoding() to us the NSString

View file

@ -752,9 +752,31 @@ static NSMapTable* port_number_2_port;
sizeof (p->_listening_address)) sizeof (p->_listening_address))
< 0) < 0)
{ {
[NSException raise: NSInternalInconsistencyException BOOL ok = NO;
format: @"[TcpInPort +newForReceivingFromPortNumber:] bind(): %s", /* bind() sometimes seems to fail when given a port of zero - this
strerror(errno)]; * should really never happen, so we retry a few times in case the
* kernel has had a temporary brainstorm.
*/
if (n == 0) {
int count;
for (count = 0; count < 10; count++) {
memset(&p->_listening_address, 0, sizeof(p->_listening_address));
p->_listening_address.sin_addr.s_addr = htonl (INADDR_ANY);
p->_listening_address.sin_family = AF_INET;
if (bind (p->_port_socket,
(struct sockaddr*) &(p->_listening_address),
sizeof (p->_listening_address)) == 0) {
ok = YES;
break;
}
}
}
if (ok == NO) {
[NSException raise: NSInternalInconsistencyException
format: @"[TcpInPort +newForReceivingFromPortNumber:] bind(): %s",
strerror(errno)];
}
} }
/* If the caller didn't specify a port number, it was chosen for us. /* If the caller didn't specify a port number, it was chosen for us.

View file

@ -427,6 +427,7 @@ property list which is set as the value of a default.\n\n");
domain = [NSMutableDictionary dictionaryWithCapacity:1]; domain = [NSMutableDictionary dictionaryWithCapacity:1];
} }
[domain setObject: obj forKey: name]; [domain setObject: obj forKey: name];
[defs setPersistentDomain: domain forName: owner];
} }
} }
else { else {
@ -469,8 +470,8 @@ property list which is set as the value of a default.\n\n");
exit(0); exit(0);
} }
} }
[defs setPersistentDomain: domain forName: owner];
} }
[defs setPersistentDomain: domain forName: owner];
if ([defs synchronize] == NO) { if ([defs synchronize] == NO) {
NSLog(@"defaults: unable to write to defaults database - %s\n", NSLog(@"defaults: unable to write to defaults database - %s\n",