GFixed recursion bug.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4451 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-21 18:40:08 +00:00
parent d151a09f46
commit be42e23da4
3 changed files with 22 additions and 21 deletions

View file

@ -1193,7 +1193,6 @@ static NSFileManager* defaultManager = nil;
DESTROY(currentFileName);
DESTROY(currentFilePath);
DESTROY(fileAttributes);
flags.shouldSkip = NO;
}
/*
@ -1240,24 +1239,27 @@ static NSFileManager* defaultManager = nil;
stringByAppendingPathComponent: currentFileName]);
// Check if directory
cpath = [manager fileSystemRepresentationWithPath: currentFilePath];
// Do not follow links
if (!flags.isFollowing)
if (flags.isRecursive == YES)
{
if (lstat(cpath, &statbuf) != 0)
break;
// If link then return it as link
if (S_IFLNK == (S_IFMT & statbuf.st_mode))
break;
}
else
{
if (stat(cpath, &statbuf) != 0)
break;
}
if (S_IFDIR == (S_IFMT & statbuf.st_mode))
{
[self recurseIntoDirectory: currentFilePath
relativeName: currentFileName];
// Do not follow links
if (!flags.isFollowing)
{
if (lstat(cpath, &statbuf) != 0)
break;
// If link then return it as link
if (S_IFLNK == (S_IFMT & statbuf.st_mode))
break;
}
else
{
if (stat(cpath, &statbuf) != 0)
break;
}
if (S_IFDIR == (S_IFMT & statbuf.st_mode))
{
[self recurseIntoDirectory: currentFilePath
relativeName: currentFileName];
}
}
break; // Got a file name - break out of loop
}
@ -1266,7 +1268,6 @@ static NSFileManager* defaultManager = nil;
[self backtrack];
}
}
flags.shouldSkip = NO;
}
// Initializing