mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
VFS: unlink() should fail when called on a directory.
This commit is contained in:
parent
754037874c
commit
a1b4f719ba
Notes:
sideshowbarker
2024-07-19 15:58:37 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a1b4f719bab
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;
|
||||
}
|
||||
|
||||
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))
|
||||
|
|
Loading…
Add table
Reference in a new issue