stat: Print an error if 'stat' fails

This commit is contained in:
Marco Cutecchia 2022-01-04 21:17:36 +01:00 committed by Andreas Kling
parent 22efc34ec5
commit 70f707d806
Notes: sideshowbarker 2024-07-17 21:39:33 +09:00

View file

@ -99,7 +99,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool had_error = false;
for (auto& file : files) {
had_error |= stat(file, should_follow_links).is_error();
auto r = stat(file, should_follow_links);
if (r.is_error()) {
had_error = true;
warnln("stat: cannot stat '{}': {}", file, strerror(r.error().code()));
}
}
return had_error;