tmpfs: Disallow creating files/folders with already used names

This commit is contained in:
apio 2023-03-11 10:14:42 +01:00
parent d95ef110c9
commit ac304073b4
Signed by: apio
GPG Key ID: B8A7D06E42258954

View File

@ -66,6 +66,8 @@ namespace TmpFS
Result<SharedPtr<VFS::Inode>> DirInode::create_file(const char* name)
{
if (find(name).has_value()) return err(EEXIST);
auto inode = TRY(m_fs->create_file_inode());
TRY(add_entry(inode, name));
@ -75,6 +77,8 @@ namespace TmpFS
Result<SharedPtr<VFS::Inode>> DirInode::create_subdirectory(const char* name)
{
if (find(name).has_value()) return err(EEXIST);
auto inode = TRY(m_fs->create_dir_inode(m_self));
TRY(add_entry(inode, name));