summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls
diff options
context:
space:
mode:
authorBrian Gianforcaro <bgianf@serenityos.org>2021-05-01 14:29:39 -0700
committerAndreas Kling <kling@serenityos.org>2021-05-02 13:27:37 +0200
commit234c6ae32d5432bdf836e510fc67756ff750c295 (patch)
tree03cf2a2738ee8666585feb9c86435d1c2a8e8f54 /Kernel/Syscalls
parentde9b454f897aee3d7b1cd1a8235a40360da5425f (diff)
downloadserenity-234c6ae32d5432bdf836e510fc67756ff750c295.zip
Kernel: Change Inode::{read/write}_bytes interface to KResultOr<ssize_t>
The error handling in all these cases was still using the old style negative values to indicate errors. We have a nicer solution for this now with KResultOr<T>. This change switches the interface and then all implementers to use the new style.
Diffstat (limited to 'Kernel/Syscalls')
-rw-r--r--Kernel/Syscalls/mmap.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp
index b8fee3101b..6c0f70f191 100644
--- a/Kernel/Syscalls/mmap.cpp
+++ b/Kernel/Syscalls/mmap.cpp
@@ -50,8 +50,8 @@ static bool should_make_executable_exception_for_dynamic_loader(bool make_readab
Elf32_Ehdr header;
auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&header);
- auto nread = inode.read_bytes(0, sizeof(header), buffer, nullptr);
- if (nread != sizeof(header))
+ auto result = inode.read_bytes(0, sizeof(header), buffer, nullptr);
+ if (result.is_error() || result.value() != sizeof(header))
return false;
// The file is a valid ELF binary