diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2019-12-13 12:20:15 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-02-14 12:16:20 +0100 |
commit | 9552f5150bb2654a0e52aad8c12973896f24f2ee (patch) | |
tree | 89c63fa93bec8e7bfe0ccb740e17df9202926a9f /lib | |
parent | e488952b9d04fb0fc7dddd31ec639549d71c76b3 (diff) | |
download | barebox-9552f5150bb2654a0e52aad8c12973896f24f2ee.tar.gz barebox-9552f5150bb2654a0e52aad8c12973896f24f2ee.tar.xz |
copy_file: call discard_range on destination file
discard the range in the output file we are going to overwrite anyway.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libfile.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; |