summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/table.c
diff options
context:
space:
mode:
authorKarel Zak2014-04-03 11:58:48 +0200
committerKarel Zak2014-04-03 12:29:21 +0200
commitc743bf744a0e2bb1aa13eb0890d109aa8a012f5c (patch)
tree2c008edcfd5972086c565a3c6e9e1861eceeaf6c /libfdisk/src/table.c
parentlibfdisk: clean up scols usage (diff)
downloadkernel-qcow2-util-linux-c743bf744a0e2bb1aa13eb0890d109aa8a012f5c.tar.gz
kernel-qcow2-util-linux-c743bf744a0e2bb1aa13eb0890d109aa8a012f5c.tar.xz
kernel-qcow2-util-linux-c743bf744a0e2bb1aa13eb0890d109aa8a012f5c.zip
cfdisk: clean up scols usage
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/table.c')
-rw-r--r--libfdisk/src/table.c7
1 files changed, 5 insertions, 2 deletions
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);