[libcxx-commits] [libcxx] [libc++] fix largefile handling in fs::copy_file (PR #121855)

Jannik Glückert via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 6 15:33:49 PST 2025


https://github.com/Jannik2099 created https://github.com/llvm/llvm-project/pull/121855

fix for https://github.com/llvm/llvm-project/pull/109211

>From 9e7d36e0f62f4297576f41068ff8de1d8a6edea5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jannik=20Gl=C3=BCckert?= <jannik.glueckert at gmail.com>
Date: Tue, 7 Jan 2025 00:32:20 +0100
Subject: [PATCH] [libc++] fix largefile handling in fs::copy_file

---
 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;
 



More information about the libcxx-commits mailing list