[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#397973: parted: Fix mac partition table corruption



The attached patch changes libparted so that it doesn't corrupt the mac parition table when flags that alter the system_name entry are set/unset. This fixes the error for me (using a mac partition table on a i386 machine).

Some minor fixes remain in partman-md and partman-lvm (lvm, swap and raid flags are mutually exclusive)

--
David Härdeman

diff -ur ./parted-1.7.1.orig/libparted/labels/mac.c ./parted-1.7.1/libparted/labels/mac.c
--- ./parted-1.7.1.orig/libparted/labels/mac.c	2006-05-25 19:28:55.000000000 +0200
+++ ./parted-1.7.1/libparted/labels/mac.c	2007-03-03 02:41:42.000000000 +0100
@@ -1260,19 +1260,23 @@
 		return 1;
 
 	case PED_PARTITION_LVM:
-		mac_data->is_lvm = state;
-		if (state)
+		if (state) {
 			strcpy (mac_data->system_name, "Linux_LVM");
-		else
-			mac_partition_set_system (part, part->fs_type);
+			mac_data->is_lvm = state;
+		} else {
+			if (mac_data->is_lvm)
+				mac_partition_set_system (part, part->fs_type);
+		}
 		return 1;
 
 	case PED_PARTITION_RAID:
-		mac_data->is_raid = state;
-		if (state)
+		if (state) {
 			strcpy (mac_data->system_name, "Linux_RAID");
-		else
+			mac_data->is_raid = state;
+		} else {
+			if (mac_data->is_raid)
 			mac_partition_set_system (part, part->fs_type);
+		}
 		return 1;
 
 	default:


Reply to: