summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/InodeFile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/FileSystem/InodeFile.cpp')
-rw-r--r--Kernel/FileSystem/InodeFile.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index 6bbb9e5873..c2657fe969 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -44,21 +44,25 @@ InodeFile::~InodeFile()
{
}
-ssize_t InodeFile::read(FileDescription& description, size_t offset, u8* buffer, ssize_t count)
+KResultOr<size_t> InodeFile::read(FileDescription& description, size_t offset, u8* buffer, size_t count)
{
ssize_t nread = m_inode->read_bytes(offset, count, buffer, &description);
if (nread > 0)
Thread::current()->did_file_read(nread);
+ if (nread < 0)
+ return KResult(nread);
return nread;
}
-ssize_t InodeFile::write(FileDescription& description, size_t offset, const u8* data, ssize_t count)
+KResultOr<size_t> InodeFile::write(FileDescription& description, size_t offset, const u8* data, size_t count)
{
ssize_t nwritten = m_inode->write_bytes(offset, count, data, &description);
if (nwritten > 0) {
m_inode->set_mtime(kgettimeofday().tv_sec);
Thread::current()->did_file_write(nwritten);
}
+ if (nwritten < 0)
+ return KResult(nwritten);
return nwritten;
}