1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

Kernel: Mark Process::jail() method as const

We really don't want callers of this function to accidentally change
the jail, or even worse - remove the Process from an attached jail.
To ensure this never happens, we can just declare this method as const
so nobody can mutate it this way.
This commit is contained in:
Liav A 2023-01-06 10:08:22 +02:00 committed by Ali Mohammad Pur
parent a03d42b098
commit 04221a7533
6 changed files with 13 additions and 13 deletions

View file

@ -52,7 +52,7 @@ ErrorOr<void> SysFSGlobalInformation::refresh_data(OpenFileDescription& descript
return ENOMEM;
}
auto builder = TRY(KBufferBuilder::try_create());
TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr<void> {
TRY(Process::current().jail().with([&](auto const& my_jail) -> ErrorOr<void> {
if (my_jail && !is_readable_by_jailed_processes())
return Error::from_errno(EPERM);
return {};