]> cvs.zerfleddert.de Git - rsbs2/blobdiff - firmware.c
use unified write_file function everywhere...
[rsbs2] / firmware.c
index 80e12e54f9ff73aaaa15449524dde10055601a7d..b57501277aa90b091d189e7fec940696c8d19458 100644 (file)
@@ -519,23 +519,8 @@ int main(int argc, char **argv)
                        strcpy(newfile, file);
                        strcat(newfile, ".patched");
 
-                       printf("Writing %s\n", newfile);
-                       if ((fd = open(newfile, O_WRONLY|O_CREAT, 0644)) == -1) {
-                               fprintf(stderr,"%s: ", newfile);
-                               perror("open");
-                               exit(1);
-                       }
-
-                       remaining = statbuf.st_size;
-
-                       while(remaining) {
-                               if ((ret = write(fd, fw + (statbuf.st_size - remaining), remaining)) == -1) {
-                                       perror("write");
-                                       exit(1);
-                               }
-                               remaining -= ret;
-                       }
-                       close(fd);
+                       printf("Firmware ");
+                       write_file(newfile, fw, statbuf.st_size);
                } else {
                        fprintf(stderr,"Can't set correct checksum, aborting...\n");
                }
Impressum, Datenschutz