mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
VirtualFileSystem: Return early in rename() when old_path==new_path
This change fixes disappearing symlink after trying to do the following thing: cp /res/icons/16x16/add-event.png . ln -s add-event.png a mv a a
This commit is contained in:
parent
0286160b62
commit
e1ed1d9176
1 changed files with 3 additions and 0 deletions
|
@ -549,6 +549,9 @@ KResult VirtualFileSystem::rename(StringView old_path, StringView new_path, Cust
|
|||
if (new_basename.is_empty() || new_basename == "."sv || new_basename == ".."sv)
|
||||
return EINVAL;
|
||||
|
||||
if (old_basename == new_basename && old_parent_inode.index() == new_parent_inode.index())
|
||||
return KSuccess;
|
||||
|
||||
if (!new_custody_or_error.is_error()) {
|
||||
auto& new_custody = *new_custody_or_error.value();
|
||||
auto& new_inode = new_custody.inode();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue