summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-07-14 20:17:09 +0000
committerpfg <pfg@FreeBSD.org>2014-07-14 20:17:09 +0000
commit7716a7c65e3caa8b0092a81c281a64939bf12533 (patch)
tree0a26489c695876fedae04cf8bae1cb8b8e2d4abe /sbin
parentcbc817e24217d5a7f54e23180e24cb0cf8008944 (diff)
downloadFreeBSD-src-7716a7c65e3caa8b0092a81c281a64939bf12533.zip
FreeBSD-src-7716a7c65e3caa8b0092a81c281a64939bf12533.tar.gz
fsck_msdosfs: be a bit more permissive
The free space value in the FSInfo block is merely unitialized when it is 0xffffffff. This fixes a bug found in NetBSD. It must be noted that we never supported all the checks that NetBSD does as some of them would cause failures with a freshly created FAT32 from MS-Windows. While here, bring some space fixes. Obtained from: NetBSD (rev. 1.22) MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck_msdosfs/fat.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sbin/fsck_msdosfs/fat.c b/sbin/fsck_msdosfs/fat.c
index d2d1444..8db861a 100644
--- a/sbin/fsck_msdosfs/fat.c
+++ b/sbin/fsck_msdosfs/fat.c
@@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp)
ret |= FSDIRTY;
else {
/* just some odd byte sequence in FAT */
-
+
switch (boot->ClustMask) {
case CLUST32_MASK:
pwarn("%s (%02x%02x%02x%02x%02x%02x%02x%02x)\n",
@@ -262,7 +262,7 @@ readfat(int fs, struct bootblock *boot, u_int no, struct fatEntry **fp)
break;
}
-
+
if (ask(1, "Correct"))
ret |= FSFIXFAT;
}
@@ -653,7 +653,7 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
cl_t head;
int mod = FSOK;
int ret;
-
+
for (head = CLUST_FIRST; head < boot->NumClusters; head++) {
/* find next untravelled chain */
if (fat[head].head != head
@@ -677,8 +677,9 @@ checklost(int dosfs, struct bootblock *boot, struct fatEntry *fat)
if (boot->bpbFSInfo) {
ret = 0;
- if (boot->FSFree != boot->NumFree) {
- pwarn("Free space in FSInfo block (%d) not correct (%d)\n",
+ if (boot->FSFree != 0xffffffffU &&
+ boot->FSFree != boot->NumFree) {
+ pwarn("Free space in FSInfo block (%u) not correct (%u)\n",
boot->FSFree, boot->NumFree);
if (ask(1, "Fix")) {
boot->FSFree = boot->NumFree;
OpenPOWER on IntegriCloud