mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
Kernel: Trying to sys$link() a directory should fail with EPERM
This commit is contained in:
parent
e91f03cb39
commit
d4d17ce423
Notes:
sideshowbarker
2024-07-19 10:02:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d4d17ce4235
@ -521,6 +521,9 @@ KResult VFS::link(StringView old_path, StringView new_path, Custody& base)
|
||||
if (!parent_inode.metadata().may_write(current->process()))
|
||||
return KResult(-EACCES);
|
||||
|
||||
if (old_inode.is_directory())
|
||||
return KResult(-EPERM);
|
||||
|
||||
return parent_inode.add_child(old_inode.identifier(), FileSystemPath(new_path).basename(), old_inode.mode());
|
||||
}
|
||||
|
||||
|
@ -255,5 +255,7 @@ int main(int, char**)
|
||||
test_eoverflow();
|
||||
test_rmdir_while_inside_dir();
|
||||
|
||||
EXPECT_ERROR_2(EPERM, link, "/", "/home/anon/lolroot");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user