mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
Utilites: Make find respect lack of -L when iterating over directories
Previously find would follow symlinks when iterating over directories even though the -L argument was not specified.
This commit is contained in:
parent
c99fd217e2
commit
f5c4d86592
1 changed files with 8 additions and 2 deletions
|
@ -457,8 +457,14 @@ static void walk_tree(const char* root_path, Command& command)
|
|||
if (dir_iterator.has_error() && dir_iterator.error() == ENOTDIR)
|
||||
return;
|
||||
|
||||
while (dir_iterator.has_next())
|
||||
walk_tree(dir_iterator.next_full_path().characters(), command);
|
||||
while (dir_iterator.has_next()) {
|
||||
auto path = dir_iterator.next_full_path();
|
||||
struct stat stat;
|
||||
if (g_follow_symlinks || ::lstat(path.characters(), &stat) < 0 || !S_ISLNK(stat.st_mode))
|
||||
walk_tree(path.characters(), command);
|
||||
else
|
||||
command.evaluate(path.characters());
|
||||
}
|
||||
|
||||
if (dir_iterator.has_error()) {
|
||||
fprintf(stderr, "%s: %s\n", root_path, dir_iterator.error_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue