summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCallum Walker <email@callumwal.kr>2021-09-11 15:39:57 +0100
committerBrian Gianforcaro <b.gianfo@gmail.com>2021-09-12 04:58:22 +0000
commitfd3735199b36e1b9a8776f377f8125bb5c93107f (patch)
tree1a7569de144d9bb177930b01b6ece498fd11a530
parent19de6bb1cc74bfda42f9b93c0a2c8f76b57a4ce9 (diff)
downloadserenity-fd3735199b36e1b9a8776f377f8125bb5c93107f.zip
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)".
-rw-r--r--Userland/Libraries/LibCore/File.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibCore/File.cpp b/Userland/Libraries/LibCore/File.cpp
index a1d67291b1..3f97cd1602 100644
--- a/Userland/Libraries/LibCore/File.cpp
+++ b/Userland/Libraries/LibCore/File.cpp
@@ -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) {