From: Karel Zak Date: Mon, 11 May 2015 10:45:21 +0000 (+0200) Subject: fdisk: provide more information by 'i'nfo command X-Git-Tag: v2.27-rc1~207 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6360bccad5c42cf1e1a4bf83369c0979edf82ec9;p=thirdparty%2Futil-linux.git fdisk: provide more information by 'i'nfo command Signed-off-by: Karel Zak --- diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 2b045743db..a4130afb9e 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -567,7 +567,7 @@ void change_partition_type(struct fdisk_context *cxt) int print_partition_info(struct fdisk_context *cxt) { struct fdisk_partition *pa = NULL; - int rc = 0, details; + int rc = 0; size_t i, nfields; int *fields = NULL; struct fdisk_label *lb = fdisk_get_label(cxt, NULL); @@ -580,11 +580,8 @@ int print_partition_info(struct fdisk_context *cxt) return rc; } - details = fdisk_is_details(cxt); - fdisk_enable_details(cxt, 1); - if ((rc = fdisk_label_get_fields_ids(lb, cxt, &fields, &nfields))) + if ((rc = fdisk_label_get_fields_ids_all(lb, cxt, &fields, &nfields))) goto clean_data; - fdisk_enable_details(cxt, details); for (i = 0; i < nfields; ++i) { int id = fields[i]; @@ -597,7 +594,8 @@ int print_partition_info(struct fdisk_context *cxt) rc = fdisk_partition_to_string(pa, cxt, id, &data); if (rc < 0) goto clean_data; - + if (!data || !*data) + continue; fdisk_info(cxt, _("%15s: %s"), fdisk_field_get_name(fd), data); free(data); }