[partition] Fix size and last sector computation
Due to a computation error when calculating the total drive space and each partition's last sector, the last partition's last sector was out of boundaries, leading to an error creating this partition. This patch fixes the computation algorithm to get rid of this error. Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>
This commit is contained in:
parent
cb60a3e7f1
commit
921f70d3bb
@ -159,7 +159,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
{
|
||||
QList< Partition* > partList;
|
||||
qint64 size, minSize, end;
|
||||
qint64 totalSize = lastSector - firstSector;
|
||||
qint64 totalSize = lastSector - firstSector + 1;
|
||||
qint64 availableSize = totalSize;
|
||||
|
||||
// TODO: Refine partition sizes to make sure there is room for every partition
|
||||
@ -176,7 +176,7 @@ PartitionLayout::execute( Device *dev, qint64 firstSector,
|
||||
size = minSize;
|
||||
if ( size > availableSize )
|
||||
size = availableSize;
|
||||
end = firstSector + size;
|
||||
end = firstSector + size - 1;
|
||||
|
||||
if ( luksPassphrase.isEmpty() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user