diff options
author | Karel Zak | 2013-09-16 16:26:52 +0200 |
---|---|---|
committer | Karel Zak | 2013-09-16 16:47:10 +0200 |
commit | 1f75d1ce6ffeb741b6d5b1e080d11fd32b0fb01e (patch) | |
tree | aca69e6a915fefc9e4e771c3420f1a6ed5e1548e /fdisks/fdisk.c | |
parent | libfdisk: make default geom usage more robust (diff) | |
download | kernel-qcow2-util-linux-1f75d1ce6ffeb741b6d5b1e080d11fd32b0fb01e.tar.gz kernel-qcow2-util-linux-1f75d1ce6ffeb741b6d5b1e080d11fd32b0fb01e.tar.xz kernel-qcow2-util-linux-1f75d1ce6ffeb741b6d5b1e080d11fd32b0fb01e.zip |
fdisk: remove unused code, coding style changes
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r-- | fdisks/fdisk.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 3ee32d28b..8bd6c4edb 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -53,8 +53,7 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out) fprintf(out, _(" %1$s [options] <disk> change partition table\n" - " %1$s [options] -l <disk> list partition table(s)\n" - " %1$s -s <partition> give partition size(s) in blocks (deprecated)\n"), + " %1$s [options] -l <disk> list partition table(s)\n"), program_invocation_short_name); fputs(USAGE_OPTIONS, out); @@ -162,7 +161,7 @@ void toggle_dos_compatibility_flag(struct fdisk_context *cxt) void change_partition_type(struct fdisk_context *cxt) { size_t i; - struct fdisk_parttype *t, *org_t; + struct fdisk_parttype *t = NULL, *org_t = NULL; assert(cxt); assert(cxt->label); @@ -173,25 +172,22 @@ void change_partition_type(struct fdisk_context *cxt) org_t = t = fdisk_get_partition_type(cxt, i); if (!t) fdisk_warnx(cxt, _("Partition %zu does not exist yet!"), i + 1); + else { + do { + t = ask_partition_type(cxt); + } while (!t); - else do { - t = ask_partition_type(cxt); - if (!t) - continue; - - if (fdisk_set_partition_type(cxt, i, t) == 0) { + if (fdisk_set_partition_type(cxt, i, t) == 0) fdisk_sinfo(cxt, FDISK_INFO_SUCCESS, _("Changed type of partition '%s' to '%s'."), org_t ? org_t->name : _("Unknown"), t ? t->name : _("Unknown")); - } else { + else fdisk_info(cxt, _("Type of partition %zu is unchanged: %s."), i + 1, org_t ? org_t->name : _("Unknown")); - } - break; - } while (1); + } fdisk_free_parttype(t); fdisk_free_parttype(org_t); |