Kernel: Reading from fd verifies that file is opened for reading
This commit is contained in:
parent
a8e3ee6f19
commit
b222581d18
|
@ -108,6 +108,8 @@ namespace Kernel
|
|||
|
||||
BAN::ErrorOr<size_t> 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;
|
||||
|
|
Loading…
Reference in New Issue