X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/ff8987a16b5e7f997ef2b6d128259279d99b2a5f..6b647fabbd6a518c7be05cb1a73b9401f2621e96:/tools/firmware-utils/src/add_header.c diff --git a/tools/firmware-utils/src/add_header.c b/tools/firmware-utils/src/add_header.c index 946068c39..37775c3e0 100644 --- a/tools/firmware-utils/src/add_header.c +++ b/tools/firmware-utils/src/add_header.c @@ -122,7 +122,7 @@ int main(int argc, char **argv) memcpy(buf, &header, sizeof(header)); // write the buf - if ((fd = open(argv[3], O_CREAT|O_WRONLY,0644)) < 0 + if ((fd = open(argv[3], O_CREAT|O_WRONLY|O_TRUNC,0644)) < 0 || write(fd, buf, buflen) != buflen || close(fd) < 0) {