mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03: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
Notes:
sideshowbarker
2024-07-18 07:09:02 +09:00
Author: https://github.com/luk1337 Commit: https://github.com/SerenityOS/serenity/commit/e1ed1d91766 Pull-request: https://github.com/SerenityOS/serenity/pull/9326 Reviewed-by: https://github.com/gunnarbeutner ✅
@ -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…
Reference in New Issue
Block a user