X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/302118701d44f3d6033d14cc5d594aeed5372fa0..464f8086da8c43cf19c15c4b2c2f0d09d5f62eb7:/tools/firmware-utils/src/imagetag.c

diff --git a/tools/firmware-utils/src/imagetag.c b/tools/firmware-utils/src/imagetag.c
index bd62b2033..e93f5f45e 100644
--- a/tools/firmware-utils/src/imagetag.c
+++ b/tools/firmware-utils/src/imagetag.c
@@ -219,6 +219,10 @@ int tagfile(const char *kernel, const char *rootfs, const char *bin,
 	fseek(binfile, rootfsoff + rootfslen - fwaddr, SEEK_SET);
 	fwrite(&deadcode, sizeof(uint32_t), 1, binfile);
 	
+	/* Flush the binfile buffer so that when we read from file, it contains
+         * everything in the buffer
+	 */
+	fflush(binfile);
 
 	/* Choose and compute the CRC32 that should be inserted in the tag */
         if ( tagid && ( (strncmp(tagid, "bccfe", TAGID_LEN) == 0)) || ( strncmp(tagid, "bc300", TAGID_LEN) == 0)) {