summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/Ext2FileSystem.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-04-10 10:58:19 +0200
committerAndreas Kling <kling@serenityos.org>2021-04-10 10:58:19 +0200
commitb5b38d372c0e9a1a837aff4d073a8531007111a3 (patch)
tree1beb2f30094c19ef32d8deb7ffce58cb87a2d7f5 /Kernel/FileSystem/Ext2FileSystem.cpp
parent19fb62dd159db5ca2f937d74ddfba05b2013674f (diff)
downloadserenity-b5b38d372c0e9a1a837aff4d073a8531007111a3.zip
Ext2FS: Clarify error handling in Ext2FSInode::read_bytes() somewhat
Diffstat (limited to 'Kernel/FileSystem/Ext2FileSystem.cpp')
-rw-r--r--Kernel/FileSystem/Ext2FileSystem.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/FileSystem/Ext2FileSystem.cpp b/Kernel/FileSystem/Ext2FileSystem.cpp
index dffbdd7363..b2eb0b4576 100644
--- a/Kernel/FileSystem/Ext2FileSystem.cpp
+++ b/Kernel/FileSystem/Ext2FileSystem.cpp
@@ -900,10 +900,10 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer&
size_t offset_into_block = (bi == first_block_logical_index) ? offset_into_first_block : 0;
size_t num_bytes_to_copy = min((off_t)block_size - offset_into_block, remaining_count);
auto buffer_offset = buffer.offset(nread);
- int err = fs().read_block(block_index, &buffer_offset, num_bytes_to_copy, offset_into_block, allow_cache);
- if (err < 0) {
+ auto result = fs().read_block(block_index, &buffer_offset, num_bytes_to_copy, offset_into_block, allow_cache);
+ if (result.is_error()) {
dmesgln("Ext2FSInode[{}]::read_bytes(): Failed to read block {} (index {})", identifier(), block_index.value(), bi);
- return err;
+ return result.error();
}
remaining_count -= num_bytes_to_copy;
nread += num_bytes_to_copy;