diff --git a/src/stirling/utils/linux_headers.cc b/src/stirling/utils/linux_headers.cc index cf4908bfff4..a4e73c8a682 100644 --- a/src/stirling/utils/linux_headers.cc +++ b/src/stirling/utils/linux_headers.cc @@ -210,16 +210,12 @@ Status FindLinuxHeadersDirectory(const std::filesystem::path& lib_modules_dir) { } StatusOr ResolvePossibleSymlinkToHostPath(const std::filesystem::path p) { - // The rest of this won't work if "p" does not exist. Go ahead and error out early if needed. - if (!fs::Exists(p)) { - return error::NotFound(absl::Substitute("Did not find host headers at path: $0.", p.string())); - } - // Check if "p" is a symlink. std::error_code ec; const bool is_symlink = std::filesystem::is_symlink(p, ec); if (ec) { - return error::Internal(ec.message()); + return error::NotFound(absl::Substitute("Did not find the host headers at path: $0, $1.", + p.string(), ec.message())); } if (!is_symlink) {