File do-not-discard-bootcode-in-extended-partition.patch of Package parted

Index: parted-1.8.8/libparted/labels/dos.c
===================================================================
--- parted-1.8.8.orig/libparted/labels/dos.c
+++ parted-1.8.8/libparted/labels/dos.c
@@ -1065,7 +1065,8 @@ write_ext_table (const PedDisk* disk,
 
 	lba_offset = ped_disk_extended_partition (disk)->geom.start;
 
-	memset (&table, 0, sizeof (DosRawTable));
+	ped_device_read (disk->dev, &table, sector, 1);
+	memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition));
 	table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
 
 	if (!fill_raw_part (&table.partitions[0], logical, sector))
@@ -1099,7 +1100,8 @@ write_empty_table (const PedDisk* disk,
 
 	PED_ASSERT (disk != NULL, return 0);
 
-	memset (&table, 0, sizeof (DosRawTable));
+	ped_device_read (disk->dev, &table, sector, 1);
+	memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition));
 	table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC);
 
 	return ped_device_write (disk->dev, (void*) &table, sector, 1);
openSUSE Build Service is sponsored by