From 4029695dbf7e296df896e8860dde5bc3a86f0451 Mon Sep 17 00:00:00 2001 From: "Tim J. Robbins" Date: Tue, 20 Apr 2004 11:41:57 +0000 Subject: [PATCH] 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 --- sbin/fsck_msdosfs/boot.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sbin/fsck_msdosfs/boot.c b/sbin/fsck_msdosfs/boot.c index 0f6a61b92d8c..32ed8633e037 100644 --- a/sbin/fsck_msdosfs/boot.c +++ b/sbin/fsck_msdosfs/boot.c @@ -33,7 +33,7 @@ #include #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[] = "$FreeBSD$"; #endif /* not lint */ @@ -159,10 +159,14 @@ readboot(dosfs, boot) perror("could not read backup bootblock"); return FSFATAL; } - if (memcmp(block, backup, DOSBOOTBLOCKSIZE)) { + backup[65] = block[65]; /* XXX */ + if (memcmp(block + 11, backup + 11, 79)) { /* Correct? XXX */ pfatal("backup doesn't compare to primary bootblock"); - return FSFATAL; + if (alwaysno) + pfatal("\n"); + else + return FSFATAL; } /* Check backup FSInfo? XXX */ } @@ -261,7 +265,7 @@ writefsinfo(dosfs, boot) * correctly, it has to be fixed pretty often. * * 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. */ return 0;