Subject: [PATCH] libparted: don't require a system id string

From: Phillip Susi <[email-masked]>
Date: Sat, 1 Mar 2014 21:25:23 -0500

Historically the system ID field of a fat boot sector contains a
string identifying the OS that formatted it.  It appears that some
recent versions of Windows have stopped bothering with this.  Stop
requiring this string to recognize fat as valid.

Signed-off-by: Phillip Susi <[email-masked]>
---
 NEWS                            | 4 ++++
 libparted/fs/fat/bootsector.c   | 7 -------
 libparted/fs/r/fat/bootsector.c | 7 -------
 3 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS
index 935fa33..819f1c6 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ GNU parted NEWS                                    -*- outline -*-
   boot partition type.
 
 ** Bug Fixes
+
+  Do not reject a FAT boot sector as invalid because it has no
+  system ID string.
+
   Fix gpt to correctly handle non ASCII charcters in partition names
 
   If a drive was 100 times an even multiple of two, sizes specified as
diff --git a/libparted/fs/fat/bootsector.c b/libparted/fs/fat/bootsector.c
index d4f8dc4..dacc79c 100644
--- a/libparted/fs/fat/bootsector.c
+++ b/libparted/fs/fat/bootsector.c
@@ -51,13 +51,6 @@ fat_boot_sector_read (FatBootSector* bs, const PedGeometry *geom)
 		return 0;
 	}
 
-	if (!bs->system_id[0]) {
-		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-			_("File system has an invalid signature for a FAT "
-			  "file system."));
-		return 0;
-	}
-
 	if (!bs->sector_size
             || PED_LE16_TO_CPU (bs->sector_size) % PED_SECTOR_SIZE_DEFAULT) {
 		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
diff --git a/libparted/fs/r/fat/bootsector.c b/libparted/fs/r/fat/bootsector.c
index 07b39cf..3aff1d7 100644
--- a/libparted/fs/r/fat/bootsector.c
+++ b/libparted/fs/r/fat/bootsector.c
@@ -51,13 +51,6 @@ fat_boot_sector_read (FatBootSector* bs, const PedGeometry *geom)
 		return 0;
 	}
 
-	if (!bs->system_id[0]) {
-		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-			_("File system has an invalid signature for a FAT "
-			  "file system."));
-		return 0;
-	}
-
 	if (!bs->sector_size
             || PED_LE16_TO_CPU (bs->sector_size) % PED_SECTOR_SIZE_DEFAULT) {
 		ped_exception_throw (PED_EXCEPTION_ERROR, PED_EXCEPTION_CANCEL,
-- 
1.8.3.2