Kernel/ProcFS: Propagate errors correctly when they occur

Calling error() on KResult is a mistake I made in 7ba991dc37, so
instead of doing that, which triggers an assertion if an error occured,
in Inode::read_entire method with VERIFY(nread <= sizeof(buffer)), we
really should just return the KResult and not to call error() on it.
This commit is contained in:
Liav A 2021-08-13 19:20:32 +03:00 committed by Gunnar Beutner
parent 1d2bde2403
commit 0a5312730c
Notes: sideshowbarker 2024-07-18 07:01:30 +09:00

View file

@ -486,7 +486,7 @@ KResultOr<size_t> ProcFSProcessPropertyInode::read_bytes(off_t offset, size_t co
if (!process)
return KResult(ESRCH);
if (auto result = try_to_acquire_data(*process, builder); result.is_error())
return result.error();
return result;
auto data_buffer = builder.build();
if (!data_buffer)
return KResult(EFAULT);