parted/do-not-discard-bootcode-in-extended-partition.patch

25 lines
1.0 KiB
Diff

Index: parted-1.9.0/libparted/labels/dos.c
===================================================================
--- parted-1.9.0.orig/libparted/labels/dos.c 2009-07-30 16:28:28.000000000 +0200
+++ parted-1.9.0/libparted/labels/dos.c 2009-07-30 16:28:53.000000000 +0200
@@ -1066,7 +1066,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))
@@ -1100,7 +1101,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);