diff options
Diffstat (limited to 'src/partition/repart.c')
-rw-r--r-- | src/partition/repart.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c index 004022f6da..ae3c0bdb26 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -645,6 +645,12 @@ static bool context_allocate_partitions(Context *context, uint64_t *ret_largest_ context->n_free_areas == 0 ? 0 : free_area_available_for_new_partitions(context, context->free_areas[context->n_free_areas-1]); + /* Check that each existing partition can fit its area. */ + for (size_t i = 0; i < context->n_free_areas; i++) + if (free_area_current_end(context, context->free_areas[i]) < + free_area_min_end(context, context->free_areas[i])) + return false; + /* A simple first-fit algorithm. We return true if we can fit the partitions in, otherwise false. */ LIST_FOREACH(partitions, p, context->partitions) { bool fits = false; |