summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk.c
diff options
context:
space:
mode:
authorKarel Zak2014-08-08 11:33:28 +0200
committerKarel Zak2014-08-08 11:33:28 +0200
commitc9400a1ea727c183f92ad8d394605fdbe65fc476 (patch)
tree5a150de2b7b70d6d4e50e3e42900591939431415 /disk-utils/fdisk.c
parentcfdisk: move curs_set(1) to ui_end() (diff)
downloadkernel-qcow2-util-linux-c9400a1ea727c183f92ad8d394605fdbe65fc476.tar.gz
kernel-qcow2-util-linux-c9400a1ea727c183f92ad8d394605fdbe65fc476.tar.xz
kernel-qcow2-util-linux-c9400a1ea727c183f92ad8d394605fdbe65fc476.zip
fdisk: always print warning for mis-aligned partitions
This patch restores the original fdisk behavior and always prints information about misaligned partitions in 'p'print output. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fdisk.c')
-rw-r--r--disk-utils/fdisk.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c
index 46e632aa3..0eeeda116 100644
--- a/disk-utils/fdisk.c
+++ b/disk-utils/fdisk.c
@@ -538,6 +538,9 @@ void list_disk_geometry(struct fdisk_context *cxt)
void list_disklabel(struct fdisk_context *cxt)
{
struct fdisk_table *tb = NULL;
+ struct fdisk_partition *pa = NULL;
+ struct fdisk_iter *itr;
+
char *str;
/* print label specific stuff by libfdisk FDISK_ASK_INFO API */
@@ -564,12 +567,20 @@ void list_disklabel(struct fdisk_context *cxt)
}
}
+ itr = fdisk_new_iter(FDISK_ITER_FORWARD);
+
+ fputc('\n', stdout);
+
+ while (itr && fdisk_table_next_partition(tb, itr, &pa) == 0)
+ fdisk_warn_alignment(cxt, fdisk_partition_get_start(pa),
+ fdisk_partition_get_partno(pa) + 1);
+
if (fdisk_table_wrong_order(tb)) {
- fputc('\n', stdout);
fdisk_info(cxt, _("Partition table entries are not in disk order."));
}
fdisk_unref_table(tb);
+ fdisk_free_iter(itr);
}
static size_t skip_empty(const unsigned char *buf, size_t i, size_t sz)