fix error checking file line count in last update

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36644 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-05-17 09:24:10 +00:00
parent b2129096ab
commit 93859d8011
2 changed files with 14 additions and 11 deletions

View file

@ -1,3 +1,8 @@
2013-05-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSMessagePortNameServer.m: fix error in line count check
in last change.
2013-05-16 Ivan Vučica <ivan@vucica.net>
* Source/GSLocale.m:

View file

@ -157,26 +157,24 @@ static void clean_up_names(void)
{
NSString *old = [path stringByAppendingPathComponent: file];
NSArray *lines;
NSString *line;
int opid;
lines = [[NSString stringWithContentsOfFile: old]
componentsSeparatedByString: @"\n"];
if ([lines count] == 2)
if ([lines count] > 1
&& (opid = [(line = [lines objectAtIndex: 1]) intValue]) > 0)
{
NSString *opid = [lines objectAtIndex: 1];
if (YES == [opid isEqual: pid])
if (YES == [line isEqual: pid])
{
NSDebugMLLog(@"NSMessagePort", @"Removing old name %@", old);
[mgr removeFileAtPath: old handler: nil];
}
else if ([opid intValue] > 0)
else if (NO == [NSProcessInfo _exists: opid])
{
if (NO == [NSProcessInfo _exists: [opid intValue]])
{
NSDebugMLLog(@"NSMessagePort",
@"Removing old name %@ for process %@", old, pid);
[mgr removeFileAtPath: old handler: nil];
}
NSDebugMLLog(@"NSMessagePort",
@"Removing old name %@ for process %d", old, opid);
[mgr removeFileAtPath: old handler: nil];
}
}
else