LibCore: Fix link_file inverting src and dst paths on duplicate names
File::link_file takes the dst_path then the src_path so on duplicate names we tried to create a link at the original file location, which then flipped the parameters back round again and we ended up with a broken link from "dst_path (1)" to "src_path (1)".
This commit is contained in:
parent
19de6bb1cc
commit
fd3735199b
Notes:
sideshowbarker
2024-07-18 04:12:22 +09:00
Author: https://github.com/callumwalker 🔰 Commit: https://github.com/SerenityOS/serenity/commit/fd3735199b3 Pull-request: https://github.com/SerenityOS/serenity/pull/9966
1 changed files with 1 additions and 1 deletions
|
@ -497,7 +497,7 @@ Result<void, OSError> File::link_file(String const& dst_path, String const& src_
|
|||
++duplicate_count;
|
||||
}
|
||||
if (duplicate_count != 0) {
|
||||
return link_file(src_path, get_duplicate_name(dst_path, duplicate_count));
|
||||
return link_file(get_duplicate_name(dst_path, duplicate_count), src_path);
|
||||
}
|
||||
int rc = symlink(src_path.characters(), dst_path.characters());
|
||||
if (rc < 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue