diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp index 20800dab8f..dbd64154f0 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/GlobalInformation.cpp @@ -55,9 +55,9 @@ ErrorOr SysFSGlobalInformation::refresh_data(OpenFileDescription& descript TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr { if (my_jail && !is_readable_by_jailed_processes()) return Error::from_errno(EPERM); - TRY(const_cast(*this).try_generate(builder)); return {}; })); + TRY(const_cast(*this).try_generate(builder)); auto& typed_cached_data = static_cast(*cached_data); typed_cached_data.buffer = builder.build(); if (!typed_cached_data.buffer) diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp index 4f7769e9a9..7486e8f2c5 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/BooleanVariable.cpp @@ -23,20 +23,22 @@ ErrorOr SysFSSystemBooleanVariable::write_bytes(off_t, size_t count, Use char value = 0; TRY(buffer.read(&value, 1)); - return Process::current().jail().with([&](auto& my_jail) -> ErrorOr { + TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr { // 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); - if (count != 1) - return Error::from_errno(EINVAL); - if (value == '0') - set_value(false); - else if (value == '1') - set_value(true); - else - return Error::from_errno(EINVAL); + return {}; + })); + if (count != 1) + return Error::from_errno(EINVAL); + if (value == '0') { + set_value(false); return 1; - }); + } else if (value == '1') { + set_value(true); + return 1; + } + return Error::from_errno(EINVAL); } ErrorOr SysFSSystemBooleanVariable::truncate(u64 size) diff --git a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp index b4aa97ba20..8064589aab 100644 --- a/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp +++ b/Kernel/FileSystem/SysFS/Subsystems/Kernel/Variables/StringVariable.cpp @@ -25,13 +25,14 @@ ErrorOr SysFSSystemStringVariable::write_bytes(off_t, size_t count, User auto new_value = TRY(KString::try_create_uninitialized(count, value)); TRY(buffer.read(value, count)); auto new_value_without_possible_newlines = TRY(KString::try_create(new_value->view().trim("\n"sv))); - return Process::current().jail().with([&](auto& my_jail) -> ErrorOr { + TRY(Process::current().jail().with([&](auto& my_jail) -> ErrorOr { // 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); - set_value(move(new_value_without_possible_newlines)); - return count; - }); + return {}; + })); + set_value(move(new_value_without_possible_newlines)); + return count; } ErrorOr SysFSSystemStringVariable::truncate(u64 size)