From fd3735199b36e1b9a8776f377f8125bb5c93107f Mon Sep 17 00:00:00 2001 From: Callum Walker Date: Sat, 11 Sep 2021 15:39:57 +0100 Subject: 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)". --- Userland/Libraries/LibCore/File.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Userland') 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 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) { -- cgit v1.2.3