diff options
author | M1cha <sigmaepsilon92@gmail.com> | 2016-07-16 09:49:42 +0200 |
---|---|---|
committer | Steve Kondik <shade@chemlab.org> | 2016-08-04 23:13:02 -0700 |
commit | a277d812472e2cf406c1f24799f5a9381c83cd98 (patch) | |
tree | ba1e8d059a1ea5ecdaae2458be6a5a45b775434d | |
parent | 9e40a0e0c47b38455d515df4900e24a547a6863f (diff) |
dtbtool: use O_TRUNC when writing to output file
otherwise you get trailing garbage when the file does already exist.
Change-Id: I020120d0742413f36ea63f37bf78e3e8dc2b8bb3
-rw-r--r-- | dtbtool/dtbtool.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/dtbtool/dtbtool.c b/dtbtool/dtbtool.c index 1ef54d8..08a1b8a 100644 --- a/dtbtool/dtbtool.c +++ b/dtbtool/dtbtool.c @@ -923,7 +923,7 @@ int main(int argc, char **argv) log_info("\nGenerating master DTB... "); - out_fd = open(output_file, O_WRONLY|O_CREAT, S_IRUSR|S_IWUSR); + out_fd = open(output_file, O_WRONLY|O_CREAT|O_TRUNC, S_IRUSR|S_IWUSR); if (out_fd == -1) { log_err("Cannot create '%s'\n", output_file); rc = RC_ERROR; |