Use the correct length when extracting the firmware. Thanks again to Llorean for spotting.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11762 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dave Chapman 2006-12-14 10:16:10 +00:00
parent 132b24163c
commit cd06755e04

View file

@ -570,14 +570,14 @@ int extract_firmware(HANDLE dh, char* filename, int start, int sector_size,
int2be(chksum,header);
memcpy(header+4,modelname,4);
outfile = open(filename,O_CREAT|O_WRONLY|O_BINARY,0666);
outfile = open(filename,O_CREAT|O_TRUNC|O_WRONLY|O_BINARY,0666);
if (outfile < 0) {
fprintf(stderr,"[ERR] Couldn't open file %s\n",filename);
return -1;
}
write(outfile,header,8);
write(outfile,sectorbuf,ipod_directory[0].len);
write(outfile,sectorbuf,length);
close(outfile);
return 0;