mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-17 07:50:04 +00:00
Kernel: Add file permission checks to link() syscall.
Also use the new name, not the old name, for the new link, duh.
This commit is contained in:
parent
a624fe06b8
commit
19acb2baf7
Notes:
sideshowbarker
2024-07-19 15:38:59 +09:00
Author: https://github.com/awesomekling
Commit: 19acb2baf7
1 changed files with 5 additions and 1 deletions
|
@ -350,8 +350,12 @@ bool VFS::link(const String& old_path, const String& new_path, Inode& base, int&
|
|||
error = -EROFS;
|
||||
return false;
|
||||
}
|
||||
if (!parent_inode->metadata().may_write(*current)) {
|
||||
error = -EACCES;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parent_inode->add_child(old_inode->identifier(), FileSystemPath(old_path).basename(), 0, error))
|
||||
if (!parent_inode->add_child(old_inode->identifier(), FileSystemPath(new_path).basename(), 0, error))
|
||||
return false;
|
||||
error = 0;
|
||||
return true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue