mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
Kernel: rename() should fail with EXDEV for cross-device requests
POSIX does not support rename() from one file system to another.
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 10:24:08 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3f74e66e823
@@ -396,6 +396,9 @@ KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
|
||||
auto& old_parent_inode = old_parent_custody->inode();
|
||||
auto& new_parent_inode = new_parent_custody->inode();
|
||||
|
||||
if (&old_parent_inode.fs() != &new_parent_inode.fs())
|
||||
return KResult(-EXDEV);
|
||||
|
||||
if (!new_parent_inode.metadata().may_write(current->process()))
|
||||
return KResult(-EACCES);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user