X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/e5be7964340496bf4b95fd82d5ebea88e2968615..83f4ab07435d0472a8d2c125adafaadbc1f4dc40:/firmware.c?ds=inline diff --git a/firmware.c b/firmware.c index 80e12e5..b575012 100644 --- a/firmware.c +++ b/firmware.c @@ -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"); }