dtbtool: use O_TRUNC when writing to output file

otherwise you get trailing garbage when the file does already exist.

Change-Id: I020120d0742413f36ea63f37bf78e3e8dc2b8bb3
diff --git a/qcom/dtbtool/dtbtool.c b/qcom/dtbtool/dtbtool.c
index 1ef54d8..08a1b8a 100644
--- a/qcom/dtbtool/dtbtool.c
+++ b/qcom/dtbtool/dtbtool.c
@@ -923,7 +923,7 @@
 
     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;