summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/FileSystem/FileDescription.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index f68112d770..3b99620018 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -106,7 +106,7 @@ off_t FileDescription::seek(off_t offset, int whence)
ssize_t FileDescription::read(u8* buffer, ssize_t count)
{
int nread = m_file->read(*this, buffer, count);
- if (m_file->is_seekable())
+ if (nread > 0 && m_file->is_seekable())
m_current_offset += nread;
return nread;
}
@@ -114,7 +114,7 @@ ssize_t FileDescription::read(u8* buffer, ssize_t count)
ssize_t FileDescription::write(const u8* data, ssize_t size)
{
int nwritten = m_file->write(*this, data, size);
- if (m_file->is_seekable())
+ if (nwritten > 0 && m_file->is_seekable())
m_current_offset += nwritten;
return nwritten;
}