From f515b5a54a929896c9ad1482f05c060f4a1b9893 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 5 Jun 2009 14:14:11 +0200 Subject: [PATCH] do not discard bootcode from extended partition * libparted/labels/dos.c (write_ext_table): Do not discard bootcode from extended partition on msdos label when some of the logical partitions are changed. Signed-off-by: Petr Uzel --- libparted/labels/dos.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c index b4cd23a..fc54339 100644 --- a/libparted/labels/dos.c +++ b/libparted/labels/dos.c @@ -1060,7 +1060,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)) @@ -1094,7 +1095,8 @@ write_empty_table (const PedDisk* disk, PedSector sector) 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); -- 1.6.0.6