Ver Fonte

Kernel/Plan9FS: Use KString instead of String in one place

Andreas Kling há 3 anos atrás
pai
commit
211c1c087d
1 ficheiros alterados com 5 adições e 4 exclusões
  1. 5 4
      Kernel/FileSystem/Plan9FileSystem.cpp

+ 5 - 4
Kernel/FileSystem/Plan9FileSystem.cpp

@@ -782,13 +782,14 @@ KResultOr<size_t> 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();