summaryrefslogtreecommitdiff
path: root/Kernel/Console.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-05-13 09:08:44 +0200
committerAndreas Kling <kling@serenityos.org>2021-05-13 23:28:40 +0200
commite46343bf9aadaf8b310821c8a92b131f2b726654 (patch)
tree4d027e4b413e82b8482865c8a8c3d9b37cdaa0ca /Kernel/Console.cpp
parent25a45e639ac48bc75507f003c692f24310688e9b (diff)
downloadserenity-e46343bf9aadaf8b310821c8a92b131f2b726654.zip
Kernel: Make UserOrKernelBuffer R/W helpers return KResultOr<size_t>
This makes error propagation less cumbersome (and also exposed some places where we were not doing it.)
Diffstat (limited to 'Kernel/Console.cpp')
-rw-r--r--Kernel/Console.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/Kernel/Console.cpp b/Kernel/Console.cpp
index 340c4d3fa8..d91d838425 100644
--- a/Kernel/Console.cpp
+++ b/Kernel/Console.cpp
@@ -57,14 +57,11 @@ Kernel::KResultOr<size_t> Console::write(FileDescription&, u64, const Kernel::Us
if (!size)
return 0;
- ssize_t nread = data.read_buffered<256>(size, [&](const u8* bytes, size_t bytes_count) {
+ return data.read_buffered<256>(size, [&](u8 const* bytes, size_t bytes_count) {
for (size_t i = 0; i < bytes_count; i++)
put_char((char)bytes[i]);
- return (ssize_t)bytes_count;
+ return bytes_count;
});
- if (nread < 0)
- return Kernel::KResult((ErrnoCode)-nread);
- return (size_t)nread;
}
void Console::put_char(char ch)