coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/3] copy: Use source file size as length while performing sparse


From: Goldwyn Rodrigues
Subject: [PATCH 2/3] copy: Use source file size as length while performing sparse_copy
Date: Thu, 31 May 2018 15:42:42 -0500

From: Goldwyn Rodrigues <address@hidden>

We wish to copy until the end of the file. However, since we know the
size of the source, we can request the size to copy.

This is a prepatory patch for copy_file_range() because it would
return an error if you attempt to copy beyond the source file size.

Signed-off-by: Goldwyn Rodrigues <address@hidden>
---
 src/copy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/copy.c b/src/copy.c
index f9621495d..3df635e81 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -1298,7 +1298,7 @@ copy_reg (char const *src_name, char const *dst_name,
       if (! sparse_copy (source_desc, dest_desc, buf, buf_size,
                          make_holes ? hole_size : 0,
                          x->sparse_mode == SPARSE_ALWAYS, src_name, dst_name,
-                         UINTMAX_MAX, &n_read,
+                         src_open_sb.st_size, &n_read,
                          &wrote_hole_at_eof))
         {
           return_val = false;
-- 
2.16.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]