diff options
-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 b2cb0d7cb..a6f43515f 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 |