1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

Kernel: Plumb OOM propagation through Custody factory

Modify the Custody::create(..) API so it has the ability to propagate
OOM back to the caller.
This commit is contained in:
Brian Gianforcaro 2021-05-10 00:28:23 -07:00 committed by Andreas Kling
parent fb93535419
commit 0b7395848a
3 changed files with 27 additions and 7 deletions

View file

@ -25,7 +25,12 @@ KResultOr<int> Process::sys$chroot(Userspace<const char*> user_path, size_t path
auto directory = directory_or_error.value();
m_root_directory_relative_to_global_root = directory;
int chroot_mount_flags = mount_flags == -1 ? directory->mount_flags() : mount_flags;
set_root_directory(Custody::create(nullptr, "", directory->inode(), chroot_mount_flags));
auto custody = Custody::create(nullptr, "", directory->inode(), chroot_mount_flags);
if (custody.is_error())
return custody.error();
set_root_directory(custody.release_value());
return 0;
}