Option 'f' currently prints following RED error message:
Nothing to do. Ordering is correct already.
Failed to fix partitions order.
This change removes RED error message when ordering is already correct.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
break;
case 'f':
rc = fdisk_reorder_partitions(cxt);
- if (rc)
+ switch (rc) {
+ default:
fdisk_warnx(cxt, _("Failed to fix partitions order."));
- else
+ break;
+ case 0:
fdisk_info(cxt, _("Partitions order fixed."));
+ break;
+ case 1:
+ fdisk_info(cxt, _("Nothing to do. Ordering is correct already."));
+ break;
+ }
break;
case 'r':
rc = fdisk_enable_details(cxt, 0);
struct pte *pei, *pek;
size_t i,k;
- if (!wrong_p_order(cxt, NULL)) {
- fdisk_info(cxt, _("Nothing to do. Ordering is correct already."));
+ if (!wrong_p_order(cxt, NULL))
return 1;
- }
while ((i = wrong_p_order(cxt, &k)) != 0 && i < 4) {
/* partition i should have come earlier, move it */
(const void *) gpt_get_entry(gpt, i),
(const void *) gpt_get_entry(gpt, i + 1)) > 0;
- if (!mess) {
- fdisk_info(cxt, _("Nothing to do. Ordering is correct already."));
+ if (!mess)
return 1;
- }
qsort(gpt->ents, nparts, sizeof(struct gpt_entry),
gpt_entry_cmp_start);