|
@@ -25,12 +25,9 @@ ErrorOr<size_t> SysFSSystemStringVariable::write_bytes(off_t, size_t count, User
|
|
auto new_value = TRY(KString::try_create_uninitialized(count, value));
|
|
auto new_value = TRY(KString::try_create_uninitialized(count, value));
|
|
TRY(buffer.read(value, count));
|
|
TRY(buffer.read(value, count));
|
|
auto new_value_without_possible_newlines = TRY(KString::try_create(new_value->view().trim("\n"sv)));
|
|
auto new_value_without_possible_newlines = TRY(KString::try_create(new_value->view().trim("\n"sv)));
|
|
- TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr<void> {
|
|
|
|
- // Note: If we are in a jail, don't let the current process to change the variable.
|
|
|
|
- if (my_jail)
|
|
|
|
- return Error::from_errno(EPERM);
|
|
|
|
- return {};
|
|
|
|
- }));
|
|
|
|
|
|
+ // NOTE: If we are in a jail, don't let the current process to change the variable.
|
|
|
|
+ if (Process::current().is_currently_in_jail())
|
|
|
|
+ return Error::from_errno(EPERM);
|
|
set_value(move(new_value_without_possible_newlines));
|
|
set_value(move(new_value_without_possible_newlines));
|
|
return count;
|
|
return count;
|
|
}
|
|
}
|