Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Jul 2014 20:17:10 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r268631 - head/sbin/fsck_msdosfs
Message-ID:  <201407142017.s6EKHA2c071402@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Mon Jul 14 20:17:09 2014
New Revision: 268631
URL: http://svnweb.freebsd.org/changeset/base/268631

Log:
  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

Modified:
  head/sbin/fsck_msdosfs/fat.c

Modified: head/sbin/fsck_msdosfs/fat.c
==============================================================================
--- head/sbin/fsck_msdosfs/fat.c	Mon Jul 14 20:13:24 2014	(r268630)
+++ head/sbin/fsck_msdosfs/fat.c	Mon Jul 14 20:17:09 2014	(r268631)
@@ -242,7 +242,7 @@ readfat(int fs, struct bootblock *boot, 
 			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, 
 				break;
 			}
 
-	
+
 			if (ask(1, "Correct"))
 				ret |= FSFIXFAT;
 		}
@@ -653,7 +653,7 @@ checklost(int dosfs, struct bootblock *b
 	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 *b
 
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407142017.s6EKHA2c071402>