[PATCH 4/4] copy_file: call discard_range on destination file

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

 



discard the range in the output file we are going to overwrite anyway.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 lib/libfile.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/libfile.c b/lib/libfile.c
index 5a1817e32a..dbeed12ccd 100644
--- a/lib/libfile.c
+++ b/lib/libfile.c
@@ -367,6 +367,8 @@ int copy_file(const char *src, const char *dst, int verbose)
 		goto out;
 	}
 
+	discard_range(dstfd, srcstat.st_size, 0);
+
 	if (verbose) {
 		if (stat(src, &srcstat) < 0)
 			srcstat.st_size = 0;
-- 
2.25.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux