Do not treat an invalid PIR table checksum as a fatal error condition, but

do print a warning about it.
Correct a stupid logic error.
Update copyrights.  Fix whitespace bug.

MFC after:	1 week
This commit is contained in:
Bruce M Simpson 2005-01-21 16:15:24 +00:00
parent b0a99991d9
commit 56bcfb6d4e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=140583

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002-2004 Bruce M. Simpson. * Copyright (c) 2002-2005 Bruce M. Simpson.
* All rights reserved * All rights reserved
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -101,7 +101,7 @@ main(int argc, char *argv[])
/* /*
* Find and print the PIR table. * Find and print the PIR table.
*/ */
if ((pir = find_pir_table(map_addr)) != NULL) { if ((pir = find_pir_table(map_addr)) == NULL) {
fprintf(stderr, "PIR table signature not found.\r\n"); fprintf(stderr, "PIR table signature not found.\r\n");
} else { } else {
dump_pir_table(pir, map_addr); dump_pir_table(pir, map_addr);
@ -152,7 +152,7 @@ find_pir_table(unsigned char *base)
pend = base + PIR_SIZE; pend = base + PIR_SIZE;
for (p = base; p < pend; p += 16) { for (p = base; p < pend; p += 16) {
if (strncmp(p, "$PIR", 4) == 0) { if (strncmp(p, "$PIR", 4) == 0) {
pir = (pir_table_t *) p; pir = (pir_table_t *)p;
break; break;
} }
} }
@ -172,7 +172,8 @@ find_pir_table(unsigned char *base)
csum += *p++; csum += *p++;
if ((csum % 256) != 0) if ((csum % 256) != 0)
pir = NULL; fprintf(stderr,
"WARNING: PIR table checksum is invalid.\n");
} }
return ((pir_table_t *)pir); return ((pir_table_t *)pir);