From 959c8f287c8794f71df52781c30f5fe6e1275612 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 18 May 2019 21:54:31 +0200 Subject: [PATCH] FileDescriptor: It's actually okay to seek past the end of a file. :^) --- Kernel/FileSystem/FileDescriptor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/FileSystem/FileDescriptor.cpp b/Kernel/FileSystem/FileDescriptor.cpp index c067c423a3..2e0b64e233 100644 --- a/Kernel/FileSystem/FileDescriptor.cpp +++ b/Kernel/FileSystem/FileDescriptor.cpp @@ -150,8 +150,9 @@ off_t FileDescriptor::seek(off_t offset, int whence) return -EINVAL; } - if (newOffset < 0 || newOffset > metadata.size) + if (newOffset < 0) return -EINVAL; + // FIXME: Return -EINVAL if attempting to seek past the end of a seekable device. m_current_offset = newOffset; return m_current_offset;