From c743bf744a0e2bb1aa13eb0890d109aa8a012f5c Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 3 Apr 2014 11:58:48 +0200 Subject: cfdisk: clean up scols usage Signed-off-by: Karel Zak --- libfdisk/src/table.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'libfdisk/src/table.c') diff --git a/libfdisk/src/table.c b/libfdisk/src/table.c index 8c86f7c17..e83ffaf4d 100644 --- a/libfdisk/src/table.c +++ b/libfdisk/src/table.c @@ -437,7 +437,7 @@ static int check_container_freespace(struct fdisk_context *cxt, if (!pa->used || !fdisk_partition_is_nested(pa)) continue; lastfree = pa->start - 1 - cxt->first_lba; - if (last + grain < lastfree) + if (last + grain <= lastfree) rc = table_add_freespace(cxt, tb, last + grain, lastfree, cont); if (rc) return rc; @@ -459,6 +459,9 @@ static int check_container_freespace(struct fdisk_context *cxt, * * This function adds freespace (described by fdisk_partition) to @table, it * allocates a new table if the @table points to NULL. + * + * Note that free space smaller than grain (see fdisk_topology_get_grain()) is + * ignored. * Returns 0 on success, otherwise, a corresponding error. */ @@ -491,7 +494,7 @@ int fdisk_get_freespaces(struct fdisk_context *cxt, struct fdisk_table **tb) continue; DBG(CXT, ul_debugobj(cxt, "freespace analyze: partno=%zu, start=%ju, end=%ju", pa->partno, pa->start, pa->end)); - if (last + grain < pa->start) { + if (last + grain <= pa->start) { rc = table_add_freespace(cxt, *tb, last + (last > cxt->first_lba ? 1 : 0), pa->start - 1, NULL); -- cgit v1.2.3-55-g7522