summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Häggqvist <rasher@rasher.dk>2005-05-12 09:24:44 +0000
committerJonas Häggqvist <rasher@rasher.dk>2005-05-12 09:24:44 +0000
commit97f784f804461a364bdabb25bb179dfc7f8b3c67 (patch)
treed62982eeb80359ef58565c5dd1f8a0dd0a8988fc
parent441e512190d00156ba8c8ed418aca00d1de6d488 (diff)
downloadrockbox-97f784f804461a364bdabb25bb179dfc7f8b3c67.tar.gz
rockbox-97f784f804461a364bdabb25bb179dfc7f8b3c67.zip
file must match one checksum, not all of them :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6457 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--tools/fwpatcher/main.c29
1 files changed, 16 insertions, 13 deletions
diff --git a/tools/fwpatcher/main.c b/tools/fwpatcher/main.c
index c8fa11ea95..b86d2f1d51 100644
--- a/tools/fwpatcher/main.c
+++ b/tools/fwpatcher/main.c
@@ -224,22 +224,25 @@ int PatchFirmware()
224 goto error; 224 goto error;
225 } 225 }
226 /* now md5sum it */ 226 /* now md5sum it */
227 if (!FileMD5(name3, md5sum_str)) goto error; 227 if (!FileMD5(name3, md5sum_str)) {
228 MessageBox(NULL, TEXT("Error in checksumming"),
229 TEXT("Error"), MB_ICONERROR);
230 goto error;
231 }
228 for (i = 0; i < sizeof(checksums)/sizeof(char *); ++i) { 232 for (i = 0; i < sizeof(checksums)/sizeof(char *); ++i) {
229 if (strncmp(checksums[i], md5sum_str, 32) != 0) { 233 if (strncmp(checksums[i], md5sum_str, 32) == 0) {
230 MessageBox(NULL, 234 /* all is fine, rename the patched file to original name of the firmware */
231 TEXT("Checksum doesn't match known good patched firmware.\n") 235 MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING);
232 TEXT("Download another firmware image, then try again."), 236 /* delete temp files */
233 TEXT("Error"), MB_ICONERROR); 237 DeleteFile(name1);
234 goto error; 238 DeleteFile(name2);
239 return 1;
235 } 240 }
236 } 241 }
237 /* all is fine, rename the patched file to original name of the firmware */ 242 MessageBox(NULL,
238 MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); 243 TEXT("Checksum doesn't match known good patched firmware.\n")
239 /* delete temp files */ 244 TEXT("Download another firmware image, then try again."),
240 DeleteFile(name1); 245 TEXT("Error"), MB_ICONERROR);
241 DeleteFile(name2);
242 return 1;
243error: 246error:
244 /* delete all temp files, don't care if some aren't created yet */ 247 /* delete all temp files, don't care if some aren't created yet */
245 DeleteFile(name1); 248 DeleteFile(name1);