From 97f784f804461a364bdabb25bb179dfc7f8b3c67 Mon Sep 17 00:00:00 2001 From: Jonas Häggqvist Date: Thu, 12 May 2005 09:24:44 +0000 Subject: file must match one checksum, not all of them :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6457 a1c6a512-1295-4272-9138-f99709370657 --- tools/fwpatcher/main.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'tools') 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() goto error; } /* now md5sum it */ - if (!FileMD5(name3, md5sum_str)) goto error; + if (!FileMD5(name3, md5sum_str)) { + MessageBox(NULL, TEXT("Error in checksumming"), + TEXT("Error"), MB_ICONERROR); + goto error; + } for (i = 0; i < sizeof(checksums)/sizeof(char *); ++i) { - if (strncmp(checksums[i], md5sum_str, 32) != 0) { - MessageBox(NULL, - TEXT("Checksum doesn't match known good patched firmware.\n") - TEXT("Download another firmware image, then try again."), - TEXT("Error"), MB_ICONERROR); - goto error; + if (strncmp(checksums[i], md5sum_str, 32) == 0) { + /* all is fine, rename the patched file to original name of the firmware */ + MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); + /* delete temp files */ + DeleteFile(name1); + DeleteFile(name2); + return 1; } } - /* all is fine, rename the patched file to original name of the firmware */ - MoveFileEx(name3, fn, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING); - /* delete temp files */ - DeleteFile(name1); - DeleteFile(name2); - return 1; + MessageBox(NULL, + TEXT("Checksum doesn't match known good patched firmware.\n") + TEXT("Download another firmware image, then try again."), + TEXT("Error"), MB_ICONERROR); error: /* delete all temp files, don't care if some aren't created yet */ DeleteFile(name1); -- cgit