1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

VFS: unlink() should fail when called on a directory.

This commit is contained in:
Andreas Kling 2019-01-23 05:35:42 +01:00
parent 754037874c
commit a1b4f719ba

View file

@ -245,6 +245,12 @@ bool VFS::unlink(const String& path, Inode& base, int& error)
return false;
}
auto inode = get_inode(inode_id);
if (inode->is_directory()) {
error = -EISDIR;
return false;
}
auto parent_inode = get_inode(parent_dir);
// FIXME: The reverse_lookup here can definitely be avoided.
if (!parent_inode->remove_child(parent_inode->reverse_lookup(inode_id), error))