mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 22:30:31 +00:00
du: Don't fail immediately when directory can't be read (#8719)
This commit is contained in:
parent
77795b2c8f
commit
334499a3f4
Notes:
sideshowbarker
2024-07-18 09:08:28 +09:00
Author: https://github.com/luk1337
Commit: 334499a3f4
Pull-request: https://github.com/SerenityOS/serenity/pull/8719
1 changed files with 5 additions and 3 deletions
|
@ -136,11 +136,13 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ret = 0;
|
||||||
|
|
||||||
if (--max_depth >= 0 && S_ISDIR(path_stat.st_mode)) {
|
if (--max_depth >= 0 && S_ISDIR(path_stat.st_mode)) {
|
||||||
auto di = Core::DirIterator(path, Core::DirIterator::SkipParentAndBaseDir);
|
auto di = Core::DirIterator(path, Core::DirIterator::SkipParentAndBaseDir);
|
||||||
if (di.has_error()) {
|
if (di.has_error()) {
|
||||||
warnln("DirIterator: {}", di.error_string());
|
warnln("du: cannot read directory '{}': {}", path, di.error_string());
|
||||||
return 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
while (di.has_next()) {
|
while (di.has_next()) {
|
||||||
const auto child_path = di.next_full_path();
|
const auto child_path = di.next_full_path();
|
||||||
|
@ -193,5 +195,5 @@ int print_space_usage(const String& path, const DuOption& du_option, int max_dep
|
||||||
outln("\t{}\t{}", formatted_time, path);
|
outln("\t{}\t{}", formatted_time, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue