From 40202705ffd397757d74f9c0ab1ac82ce990a2c9 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Mon, 22 Jul 2019 16:33:00 +0200 Subject: [PATCH] libcalamares: Align partition sizes on actual sectors Currently, the `bytesToSectors()` function rounds a partition size to the nearest MiB unit, which may lead to inconsistencies when a partition is expected to only be a few KiB's. This patch changes the behaviour of `bytesToSectors()` so that it aligns on sector size, without rounding the partition size to a multiple of 1MiB. Signed-off-by: Arnaud Ferraris --- src/libcalamares/utils/Units.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcalamares/utils/Units.h b/src/libcalamares/utils/Units.h index b869d7dde..7b8b8c172 100644 --- a/src/libcalamares/utils/Units.h +++ b/src/libcalamares/utils/Units.h @@ -160,7 +160,7 @@ alignBytesToBlockSize( qint64 bytes, qint64 blocksize ) constexpr qint64 bytesToSectors( qint64 bytes, qint64 blocksize ) { - return alignBytesToBlockSize( alignBytesToBlockSize( bytes, blocksize ), MiBtoBytes( 1ULL ) ) / blocksize; + return alignBytesToBlockSize( bytes, blocksize ) / blocksize; } } // namespace CalamaresUtils