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:
Callum Walker 2021-09-11 15:39:57 +01:00 committed by Brian Gianforcaro
parent 19de6bb1cc
commit fd3735199b
Notes: sideshowbarker 2024-07-18 04:12:22 +09:00

View file

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