From 70f707d806294eac9858ff55bb555385c3145eb5 Mon Sep 17 00:00:00 2001 From: Marco Cutecchia Date: Tue, 4 Jan 2022 21:17:36 +0100 Subject: [PATCH] stat: Print an error if 'stat' fails --- Userland/Utilities/stat.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/Utilities/stat.cpp b/Userland/Utilities/stat.cpp index 0f0a2ab232..b34a893284 100644 --- a/Userland/Utilities/stat.cpp +++ b/Userland/Utilities/stat.cpp @@ -99,7 +99,11 @@ ErrorOr 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;