From 1f1e58ed75613dfa9f549c0d205ecb0e57ac8ebb Mon Sep 17 00:00:00 2001 From: Freakness109 Date: Fri, 16 Dec 2022 22:21:18 +0100 Subject: Kernel/Plan9FS: Propagate errors in Plan9FSMessage::append_data --- Kernel/FileSystem/Plan9FS/Inode.cpp | 2 +- Kernel/FileSystem/Plan9FS/Message.cpp | 6 +++--- Kernel/FileSystem/Plan9FS/Message.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Kernel/FileSystem/Plan9FS/Inode.cpp b/Kernel/FileSystem/Plan9FS/Inode.cpp index 9dc620a66a..05093a3945 100644 --- a/Kernel/FileSystem/Plan9FS/Inode.cpp +++ b/Kernel/FileSystem/Plan9FS/Inode.cpp @@ -111,7 +111,7 @@ ErrorOr Plan9FSInode::write_bytes_locked(off_t offset, size_t size, User Plan9FSMessage message { fs(), Plan9FSMessage::Type::Twrite }; message << fid() << (u64)offset; - message.append_data(data_copy->view()); + TRY(message.append_data(data_copy->view())); TRY(fs().post_message_and_wait_for_a_reply(message)); u32 nwritten; diff --git a/Kernel/FileSystem/Plan9FS/Message.cpp b/Kernel/FileSystem/Plan9FS/Message.cpp index 733e6cef5d..69272b63f4 100644 --- a/Kernel/FileSystem/Plan9FS/Message.cpp +++ b/Kernel/FileSystem/Plan9FS/Message.cpp @@ -38,11 +38,11 @@ Plan9FSMessage& Plan9FSMessage::operator<<(StringView string) return *this; } -void Plan9FSMessage::append_data(StringView data) +ErrorOr Plan9FSMessage::append_data(StringView data) { *this << static_cast(data.length()); - // FIXME: Handle append failure. - (void)m_builder.append(data); + TRY(m_builder.append(data)); + return {}; } Plan9FSMessage::Decoder& Plan9FSMessage::Decoder::operator>>(u8& number) diff --git a/Kernel/FileSystem/Plan9FS/Message.h b/Kernel/FileSystem/Plan9FS/Message.h index d5e178a0d0..41d5f6f91d 100644 --- a/Kernel/FileSystem/Plan9FS/Message.h +++ b/Kernel/FileSystem/Plan9FS/Message.h @@ -135,7 +135,7 @@ public: Plan9FSMessage& operator<<(u32); Plan9FSMessage& operator<<(u64); Plan9FSMessage& operator<<(StringView); - void append_data(StringView); + ErrorOr append_data(StringView); template Plan9FSMessage& operator>>(T& t) -- cgit v1.2.3