1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 16:18:12 +00:00

LibCore: Report error condition when reading process statistics failed

This commit is contained in:
Tom 2021-01-01 20:58:47 -07:00 committed by Andreas Kling
parent 754bf22da7
commit cf89180c35
12 changed files with 94 additions and 74 deletions

View file

@ -197,10 +197,14 @@ bool generate_profile(pid_t pid)
String process_name;
auto all_processes = Core::ProcessStatisticsReader::get_all();
if (auto it = all_processes.find(pid); it != all_processes.end())
process_name = it->value.name;
else
if (all_processes.has_value()) {
if (auto it = all_processes.value().find(pid); it != all_processes.value().end())
process_name = it->value.name;
else
process_name = "(unknown)";
} else {
process_name = "(unknown)";
}
if (profiling_enable(pid) < 0) {
int saved_errno = errno;