Kernel: Ext2 fill now return ENOTSUP on write

We used to crash the kernel
This commit is contained in:
Bananymous 2023-07-10 15:34:10 +03:00
parent 773747cf9c
commit 1e173c178d
2 changed files with 11 additions and 0 deletions

View File

@ -145,6 +145,7 @@ namespace Kernel
virtual BAN::ErrorOr<BAN::RefPtr<Inode>> directory_find_inode(BAN::StringView) override;
virtual BAN::ErrorOr<size_t> read(size_t, void*, size_t) override;
virtual BAN::ErrorOr<size_t> write(size_t, const void*, size_t) override;
virtual BAN::ErrorOr<void> create_file(BAN::StringView, mode_t, uid_t, gid_t) override;

View File

@ -291,6 +291,16 @@ namespace Kernel
return n_read;
}
BAN::ErrorOr<size_t> Ext2Inode::write(size_t offset, const void* buffer, size_t count)
{
(void)offset;
(void)buffer;
(void)count;
if (mode().ifdir())
return BAN::Error::from_errno(EISDIR);
return BAN::Error::from_errno(ENOTSUP);
}
BAN::ErrorOr<void> Ext2Inode::directory_read_next_entries(off_t offset, DirectoryEntryList* list, size_t list_size)
{
if (!mode().ifdir())