mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 20:25:07 +00:00
Kernel: Tidy up Coredump construction
- Use KResultOr and TRY to propagate errors - Return more specific errors now that they have a path out from here
This commit is contained in:
parent
c11c0fe453
commit
60eea6940f
3 changed files with 26 additions and 39 deletions
|
@ -553,10 +553,10 @@ bool Process::dump_core()
|
|||
VERIFY(should_generate_coredump());
|
||||
dbgln("Generating coredump for pid: {}", pid().value());
|
||||
auto coredump_path = String::formatted("/tmp/coredump/{}_{}_{}", name(), pid().value(), kgettimeofday().to_truncated_seconds());
|
||||
auto coredump = Coredump::create(*this, coredump_path);
|
||||
if (!coredump)
|
||||
auto coredump_or_error = Coredump::try_create(*this, coredump_path);
|
||||
if (coredump_or_error.is_error())
|
||||
return false;
|
||||
return !coredump->write().is_error();
|
||||
return !coredump_or_error.value()->write().is_error();
|
||||
}
|
||||
|
||||
bool Process::dump_perfcore()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue