summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-09-28 13:12:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-09-29 12:10:59 +0200
commitd4f5bb1e011ac653a167031554f0ac9e028e9e36 (patch)
tree22254cc75f9d0735c47d86d0c1d63f3c879f1be0 /lib
parente2b67d6a6a4deccb4b9041124fc251c12a81ecf9 (diff)
downloadbarebox-d4f5bb1e011ac653a167031554f0ac9e028e9e36.tar.gz
barebox-d4f5bb1e011ac653a167031554f0ac9e028e9e36.tar.xz
copy_file: Add missing O_TRUNC
Without it, when copying a smaller file over a larger file the resulting file still has the remaining space from the larger file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/copy_file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/copy_file.c b/lib/copy_file.c
index 55dee38e61..778cc00901 100644
--- a/lib/copy_file.c
+++ b/lib/copy_file.c
@@ -29,7 +29,7 @@ int copy_file(const char *src, const char *dst, int verbose)
goto out;
}
- dstfd = open(dst, O_WRONLY | O_CREAT);
+ dstfd = open(dst, O_WRONLY | O_CREAT | O_TRUNC);
if (dstfd < 0) {
printf("could not open %s: %s\n", dst, errno_str());
goto out;