util/fletcher: fix debug option parsing

sizeof(char[]-type+1) isn't very useful. Since one of
the strings is constant, we also don't need to use
strncmp that string's length. While at it, str*cmp don't
return booleans, so check for value instead of faux bools.

Change-Id: Iebb194a60eac454dafeade75f135df92068cf4ab
Found-by: Coverity Scan
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Reviewed-on: http://review.coreboot.org/6988
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
This commit is contained in:
Patrick Georgi 2014-09-29 10:12:29 +02:00 committed by Patrick Georgi
parent 02802dfa5a
commit 667c7a3b23
1 changed files with 1 additions and 1 deletions

View File

@ -111,7 +111,7 @@ int main(int argc, char **argv)
checksum = fletcher32(&buffer[2], filesize/2 - 2);
*((uint32_t *)& buffer[2]) = checksum;
#ifndef DEBUG
if ((argc == 2) && !strncmp(argv[1], debugoption, sizeof(debugoption+1))) {
if ((argc == 2) && (strcmp(argv[1], debugoption) == 0)) {
#endif
fprintf(stderr, "Fletcher's Checksum: %x\n", checksum);
#ifndef DEBUG