From faa3f752896903c2d09d389970d3d0ebf50a1073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannik=20Gl=C3=BCckert?= Date: Tue, 7 Jan 2025 15:29:35 +0100 Subject: [PATCH] [libc++] Fix largefile handling in fs::copy_file (#121855) Fix for issues reported in https://github.com/llvm/llvm-project/pull/109211 --- libcxx/src/filesystem/operations.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libcxx/src/filesystem/operations.cpp b/libcxx/src/filesystem/operations.cpp index bd37c5af86f6c3..208a55723d8838 100644 --- a/libcxx/src/filesystem/operations.cpp +++ b/libcxx/src/filesystem/operations.cpp @@ -238,8 +238,14 @@ bool copy_file_impl_copy_file_range(FileDescriptor& read_fd, FileDescriptor& wri return false; } // do not modify the fd positions as copy_file_impl_sendfile may be called after a partial copy +# if defined(__linux__) + loff_t off_in = 0; + loff_t off_out = 0; +# else off_t off_in = 0; off_t off_out = 0; +# endif + do { ssize_t res;