X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/ff8987a16b5e7f997ef2b6d128259279d99b2a5f..86154153a622f87b6cc6209e355351975c82efb4:/tools/firmware-utils/src/add_header.c?ds=sidebyside 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) {