Fix logical partition grow overlaps extended partition end (#686668)

In certain situations with a mixture of partition alignments, the MiB
alignment option would try to set the end of a logical partition
beyond the end of the extended partition.  This, of course, is an
invalid partition geometry and the libparted library correctly reports
failure when this is attempted.

This enhancement to MiB alignment adds a check to see if the end of
the logical partition would be beyond the extended partition, and
adjusts the end of the logical partition if required.

Closes Bug #686668 - Growing logical partition overlaps end of
                     extended partition
This commit is contained in:
Curtis Gedak 2012-11-25 14:01:52 -07:00 committed by Mike Fleetwood
parent fd96328920
commit 83ccbce199
1 changed files with 7 additions and 0 deletions

View File

@ -543,6 +543,13 @@ bool GParted_Core::snap_to_mebibyte( const Device & device, Partition & partitio
partition .sector_end -= ( MEBIBYTE / partition .sector_size ) ;
}
}
//If the logical partition end is beyond the end of the extended partition
// then reduce logical partition end by a mebibyte to address the overlap.
if ( ( index_extended != -1 )
&& ( partition .sector_end > device .partitions[ index_extended ] .sector_end )
)
partition .sector_end -= ( MEBIBYTE / partition .sector_size ) ;
}
//If this is a primary or an extended partition and the partition overlaps