Only compare the interesting part of the bootblock with its backup.

Allow check to proceed with bad backup boot block if we're doing a
readonly check. Various typos in comments.

Obtained from:	NetBSD
This commit is contained in:
Tim J. Robbins 2004-04-20 11:41:57 +00:00
parent 3c8487013c
commit 4029695dbf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128463

View File

@ -33,7 +33,7 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifndef lint #ifndef lint
__RCSID("$NetBSD: boot.c,v 1.5 1997/10/17 11:19:23 ws Exp $"); __RCSID("$NetBSD: boot.c,v 1.9 2003/07/24 19:25:46 ws Exp $");
static const char rcsid[] = static const char rcsid[] =
"$FreeBSD$"; "$FreeBSD$";
#endif /* not lint */ #endif /* not lint */
@ -159,10 +159,14 @@ readboot(dosfs, boot)
perror("could not read backup bootblock"); perror("could not read backup bootblock");
return FSFATAL; return FSFATAL;
} }
if (memcmp(block, backup, DOSBOOTBLOCKSIZE)) { backup[65] = block[65]; /* XXX */
if (memcmp(block + 11, backup + 11, 79)) {
/* Correct? XXX */ /* Correct? XXX */
pfatal("backup doesn't compare to primary bootblock"); pfatal("backup doesn't compare to primary bootblock");
return FSFATAL; if (alwaysno)
pfatal("\n");
else
return FSFATAL;
} }
/* Check backup FSInfo? XXX */ /* Check backup FSInfo? XXX */
} }
@ -261,7 +265,7 @@ writefsinfo(dosfs, boot)
* correctly, it has to be fixed pretty often. * correctly, it has to be fixed pretty often.
* *
* Therefor, we handle the FSINFO block only informally, * Therefor, we handle the FSINFO block only informally,
* fixing it if neccessary, but otherwise ignoring the * fixing it if necessary, but otherwise ignoring the
* fact that it was incorrect. * fact that it was incorrect.
*/ */
return 0; return 0;