diff options
author | Liav A <liavalb@gmail.com> | 2023-01-06 10:08:22 +0200 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2023-01-07 03:44:59 +0330 |
commit | 04221a753394cf87213551c69c7cd9a7d4a899cd (patch) | |
tree | e4f6ea1dac9f9b86502fb68eb2267e15e9a74e9e /Kernel/Devices | |
parent | a03d42b098e3bd8fb1149231b449996ecad3047c (diff) | |
download | serenity-04221a753394cf87213551c69c7cd9a7d4a899cd.zip |
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.
Diffstat (limited to 'Kernel/Devices')
-rw-r--r-- | Kernel/Devices/Device.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp index df306c7d92..8e9cd4dd45 100644 --- a/Kernel/Devices/Device.cpp +++ b/Kernel/Devices/Device.cpp @@ -60,7 +60,7 @@ ErrorOr<NonnullOwnPtr<KString>> Device::pseudo_path(OpenFileDescription const&) ErrorOr<NonnullLockRefPtr<OpenFileDescription>> Device::open(int options) { - 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_openable_by_jailed_processes()) return Error::from_errno(EPERM); return {}; |