1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 05:07:45 +00:00

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

View file

@ -99,7 +99,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
bool had_error = false; bool had_error = false;
for (auto& file : files) { 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; return had_error;