mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-12 09:20:36 +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
Notes:
sideshowbarker
2024-07-18 17:52:59 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/f5c4d865923 Pull-request: https://github.com/SerenityOS/serenity/pull/7236
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…
Reference in a new issue