Kernel: Cleanup hardlink creation

This commit is contained in:
Bananymous 2025-08-27 00:21:38 +03:00
parent f994210927
commit 16a5a234c1
2 changed files with 3 additions and 3 deletions

View File

@ -569,9 +569,7 @@ done:
{
ASSERT(this->mode().ifdir());
ASSERT(!inode->mode().ifdir());
if (&m_fs != inode->filesystem())
return BAN::Error::from_errno(EXDEV);
ASSERT(&m_fs == inode->filesystem());
if (!find_inode_impl(name).is_error())
return BAN::Error::from_errno(EEXIST);

View File

@ -107,6 +107,8 @@ namespace Kernel
return BAN::Error::from_errno(ENOTDIR);
if (inode->mode().ifdir())
return BAN::Error::from_errno(EINVAL);
if (this->filesystem() != inode->filesystem())
return BAN::Error::from_errno(EXDEV);
if (auto* fs = filesystem(); fs && (fs->flag() & ST_RDONLY))
return BAN::Error::from_errno(EROFS);
return link_inode_impl(name, inode);