diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 19:02:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 19:02:57 +0200 |
commit | 100b3835f023205db34129cca3cf854ad908478c (patch) | |
tree | 9ad87623d9c0104939a8347bf11c7b5562d8cb87 /Kernel/FileSystem | |
parent | 667a39df6bf9adfc1929f26313b02e19503d8a95 (diff) | |
download | serenity-100b3835f023205db34129cca3cf854ad908478c.zip |
Kernel: Use TRY() in DevFSLinkInode::write_bytes()
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r-- | Kernel/FileSystem/DevFS.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index 1571cb3d2e..ce069aa865 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -175,14 +175,12 @@ InodeMetadata DevFSLinkInode::metadata() const KResultOr<size_t> DevFSLinkInode::write_bytes(off_t offset, size_t count, UserOrKernelBuffer const& buffer, FileDescription*) { - auto kstring_or_error = buffer.try_copy_into_kstring(count); - if (kstring_or_error.is_error()) - return kstring_or_error.error(); + auto new_string = TRY(buffer.try_copy_into_kstring(count)); MutexLocker locker(m_inode_lock); VERIFY(offset == 0); VERIFY(buffer.is_kernel_buffer()); - m_link = kstring_or_error.release_value(); + m_link = move(new_string); return count; } |