1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 22:34:59 +00: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:
Andreas Kling 2020-01-03 04:10:05 +01:00
parent bbedad1197
commit 3f74e66e82

View file

@ -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);