aboutsummaryrefslogtreecommitdiff
path: root/tools/fit_common.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-11-12 12:28:05 -0700
committerSimon Glass <sjg@chromium.org>2022-01-26 08:50:43 -0700
commit7ae46c35793bcc034f1300d8b79e3fd7e506537c (patch)
treec82d8c9bb34d430b5099c9b72a6bea7c52c7ae6d /tools/fit_common.h
parente291a5c9a2acff16ba3b976198bba7da9828c9e9 (diff)
tools: Avoid leaving extra data at the end of copied files
The copyfile() implementation has strange behaviour if the destination file already exists. Update it to ensure that any existing data in the destination file is dropped. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/fit_common.h')
-rw-r--r--tools/fit_common.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/fit_common.h b/tools/fit_common.h
index 872d8afa17..c600dc2ba4 100644
--- a/tools/fit_common.h
+++ b/tools/fit_common.h
@@ -44,6 +44,8 @@ int mmap_fdt(const char *cmdname, const char *fname, size_t size_inc,
*
* This uses read()/write() to copy file @src to file @dst
*
+ * If @dst exists, it is overwritten and truncated to the correct size.
+ *
* @src: Filename to read from
* @dst: Filename to write to
* @return 0 if OK, -1 on error