X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/ff8987a16b5e7f997ef2b6d128259279d99b2a5f..c6f1dc90c0ee615e612d519ab3f1be62752b4f9c:/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) {