diff options
| author | Karel Zak <kzak@redhat.com> | 2018-08-01 09:29:12 +0200 |
|---|---|---|
| committer | Karel Zak <kzak@redhat.com> | 2018-08-01 09:29:12 +0200 |
| commit | dbcd1a4964a6b23bbf2566fac76175179cb662d5 (patch) | |
| tree | 4b8c6a96578d8a251a874501f251984ead55d6f6 /disk-utils/fdisk-menu.c | |
| parent | d5fd9ac6b208c5acdb6c0023757a7e2827474482 (diff) | |
| download | util-linux-dbcd1a4964a6b23bbf2566fac76175179cb662d5.tar.gz | |
fdisk: fix error message on 'd' command
Command (m for help): d
No partition is defined yet!
Could not delete partition 93840461057817 <--- !
Don't print 'Could not delete..' if no partition is defined yet.
Addresses: https://github.com/karelzak/util-linux/issues/667
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils/fdisk-menu.c')
| -rw-r--r-- | disk-utils/fdisk-menu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c index b2cb0d7cb9..a6f43515fb 100644 --- a/disk-utils/fdisk-menu.c +++ b/disk-utils/fdisk-menu.c @@ -650,8 +650,10 @@ static int generic_menu_cb(struct fdisk_context **cxt0, switch (ent->key) { case 'd': rc = fdisk_ask_partnum(cxt, &n, FALSE); - if (!rc) - rc = fdisk_delete_partition(cxt, n); + if (rc) + break; /* no partitions yet (or ENOMEM, ...) */ + + rc = fdisk_delete_partition(cxt, n); if (rc) fdisk_warnx(cxt, _("Could not delete partition %zu"), n + 1); else |
