mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
VFS: unlink() should fail when called on a directory.
This commit is contained in:
parent
754037874c
commit
a1b4f719ba
1 changed files with 6 additions and 0 deletions
|
@ -245,6 +245,12 @@ bool VFS::unlink(const String& path, Inode& base, int& error)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto inode = get_inode(inode_id);
|
||||||
|
if (inode->is_directory()) {
|
||||||
|
error = -EISDIR;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
auto parent_inode = get_inode(parent_dir);
|
auto parent_inode = get_inode(parent_dir);
|
||||||
// FIXME: The reverse_lookup here can definitely be avoided.
|
// FIXME: The reverse_lookup here can definitely be avoided.
|
||||||
if (!parent_inode->remove_child(parent_inode->reverse_lookup(inode_id), error))
|
if (!parent_inode->remove_child(parent_inode->reverse_lookup(inode_id), error))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue