firmware-utils: when using open with O_CREAT and O_WRONLY, also use O_TRUNC to ensure...
[openwrt.git] / tools / firmware-utils / src / add_header.c
index 946068c..37775c3 100644 (file)
@@ -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)
        {
This page took 0.021222 seconds and 4 git commands to generate.