Kernel: Use credentials object in Coredump:try_create_target_file

This commit is contained in:
James Bellamy 2022-08-21 12:21:48 +01:00 committed by Andreas Kling
parent 78813313f9
commit 8ef5dbed21

View file

@ -68,12 +68,13 @@ ErrorOr<NonnullLockRefPtr<OpenFileDescription>> Coredump::try_create_target_file
dbgln("Refusing to put coredump in sketchy directory '{}'", output_directory);
return EINVAL;
}
auto credentials = process.credentials();
return TRY(VirtualFileSystem::the().open(
KLexicalPath::basename(output_path),
O_CREAT | O_WRONLY | O_EXCL,
S_IFREG, // We will enable reading from userspace when we finish generating the coredump file
*dump_directory,
UidAndGid { process.uid(), process.gid() }));
UidAndGid { credentials->uid(), credentials->gid() }));
}
ErrorOr<void> Coredump::write_elf_header()