From: hadaq Date: Tue, 12 Jun 2012 16:00:02 +0000 (+0000) Subject: fixed stringId bug X-Git-Tag: v6.0~42 X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=2080783210e02888d344fd1d6091d4b6ce8f4b80;p=trbnettools.git fixed stringId bug --- diff --git a/libtrbnet/trbflash.c b/libtrbnet/trbflash.c index 85bd0f8..aacd2f3 100644 --- a/libtrbnet/trbflash.c +++ b/libtrbnet/trbflash.c @@ -120,7 +120,7 @@ typedef struct { } FlashParam; static FlashParam flashParamRef; -static const char trbflash_version[] = "$Revision: 2.39 $"; +static const char trbflash_version[] = "$Revision: 2.40 $"; static uint32_t mdcFlashSelect = 1; @@ -1077,16 +1077,20 @@ static int prepareImageBuffer() while (strlen(flashParamRef.allowedStringId[j]) > 0) { if (memcmp(imageBuffer + i, flashParamRef.allowedStringId[j], - strlen(flashParamRef.allowedStringId[j]))) { + strlen(flashParamRef.allowedStringId[j])) == 0) { match = 1; break; } + j++; } } if ((skipFirmwareIdCheck == 0) && (match == 0)) { fprintf(logFile, "Error > prepareImageBuffer: " - "invalid Firmware-Id of Image-File\n"); + "invalid Firmware-Id of Image-File, should be one of:\n"); + for (i = 0; strlen(flashParamRef.allowedStringId[i]) > 0; i++) { + fprintf(logFile, " %s\n", flashParamRef.allowedStringId[i]); + } return -1; } @@ -1570,7 +1574,8 @@ int main(int argc, char **argv) } /* In case of MDC: select FlashRom */ - if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { + if ((flashParamRef.flashType == FLASH_MDC_OEP_V2) || + (flashParamRef.flashType == FLASH_MDC_OEP_V3)) { if (selectMdcFlashRom(trb_address, mdcFlashSelect) == -1) { exit(EXIT_FAILURE); }