[parted-devel] [PATCH] Do not discard bootcode from extended partition

Bryn M. Reeves bmr at redhat.com
Fri Jan 23 10:29:05 UTC 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Petr Uzel wrote:
>  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 cb7e45e..a300a87 100644
> --- a/libparted/labels/dos.c
> +++ b/libparted/labels/dos.c
> @@ -1059,7 +1059,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))
> @@ -1093,7 +1094,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);

Hi Petr,

Thanks! Patch looks good to me - I will try to find time this afternoon
to do a quick test (should be easily reproduced/verified with the steps
from your earlier post).

Regards,
Bryn.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkl5m/EACgkQ6YSQoMYUY97V8gCgu1nZwJdsva+db4Nz1nRsbUpf
c80AoJz0LB8oUKxJbRR9JBK++uKRm8UQ
=Q8lE
-----END PGP SIGNATURE-----



More information about the parted-devel mailing list