get rid of $Id$ - it has never helped us and it has broken too many patches ;)
[openwrt/svn-archive/archive.git] / tools / firmware-utils / src / motorola-bin.c
index 680249c0072c5f7ca4348a7c57716abdea8dabe2..fecb4ce95bee34ddd3c37719d172e6508b164239 100644 (file)
@@ -6,7 +6,6 @@
  *                         D. Hugh Redelmeier
  *                         OpenWrt.org
  *
- * $Id$
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -170,7 +169,7 @@ int main(int argc, char **argv)
                        exit(3);
                } else {
                        // all is well, write the file without the prefix
-                       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, trx + sizeof(struct motorola), len - sizeof(struct motorola)) !=  len - sizeof(struct motorola)
                        || close(fd) < 0)
                        {
@@ -211,7 +210,7 @@ int main(int argc, char **argv)
                firmware->crc = htonl(crc32buf((unsigned char *)&firmware->flags, sizeof(firmware->flags) + len));
 
                // write the firmware
-               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, firmware, sizeof(struct motorola) + len) != sizeof(struct motorola) + len
                || close(fd) < 0)
                {