diff --git a/kernel/kernel/Process.cpp b/kernel/kernel/Process.cpp index 1a7a2b8e5f..208e37bfda 100644 --- a/kernel/kernel/Process.cpp +++ b/kernel/kernel/Process.cpp @@ -108,6 +108,8 @@ namespace Kernel BAN::ErrorOr Process::OpenFileDescription::read(void* buffer, size_t count) { + if (!(flags & O_RDONLY)) + return BAN::Error::from_errno(EBADF); size_t n_read = TRY(inode->read(offset, buffer, count)); offset += n_read; return n_read;