From 211c1c087d0422c2cf9586cdf5d0d5f4ee43399c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 4 Sep 2021 23:45:04 +0200 Subject: [PATCH] Kernel/Plan9FS: Use KString instead of String in one place --- Kernel/FileSystem/Plan9FileSystem.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Kernel/FileSystem/Plan9FileSystem.cpp b/Kernel/FileSystem/Plan9FileSystem.cpp index 2d0c23df81..ed6bbbf40f 100644 --- a/Kernel/FileSystem/Plan9FileSystem.cpp +++ b/Kernel/FileSystem/Plan9FileSystem.cpp @@ -782,13 +782,14 @@ KResultOr Plan9FSInode::write_bytes(off_t offset, size_t size, const Use size = fs().adjust_buffer_size(size); - auto data_copy = data.copy_into_string(size); // FIXME: this seems ugly - if (data_copy.is_null()) - return EFAULT; + auto data_copy_or_error = data.try_copy_into_kstring(size); // FIXME: this seems ugly + if (data_copy_or_error.is_error()) + return data_copy_or_error.error(); + auto data_copy = data_copy_or_error.release_value(); Plan9FS::Message message { fs(), Plan9FS::Message::Type::Twrite }; message << fid() << (u64)offset; - message.append_data(data_copy); + message.append_data(data_copy->view()); result = fs().post_message_and_wait_for_a_reply(message); if (result.is_error()) return result.error();