summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorDavidlohr Bueso2012-10-07 16:33:37 +0200
committerKarel Zak2012-10-18 12:15:33 +0200
commit1f5eb51b79275e32d045fd6718753bf04cde8374 (patch)
tree208809ee5e82cd2440c0c8b77ee59470dbc2ce43 /fdisks/fdisk.c
parentdocs: update deprecated file (diff)
downloadkernel-qcow2-util-linux-1f5eb51b79275e32d045fd6718753bf04cde8374.tar.gz
kernel-qcow2-util-linux-1f5eb51b79275e32d045fd6718753bf04cde8374.tar.xz
kernel-qcow2-util-linux-1f5eb51b79275e32d045fd6718753bf04cde8374.zip
fdisk: api: propagate partition deletion to users
The generic fdisk_delete_partition() function returns 0 when a partition is correctly deleted, otherwise it's corresponding error (negative values). This, however, does not include problems that can occur in actual label specific contexts, so we need to propagate the corresponding return code, back to the user visible api. Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 5e7c2e5e9..1295d54e7 100644
--- a/fdisks/fdisk.c
+++ b/fdisks/fdisk.c
@@ -841,8 +841,10 @@ static void delete_partition(struct fdisk_context *cxt, int partnum)
return;
ptes[partnum].changed = 1;
- fdisk_delete_partition(cxt, partnum);
- printf(_("Partition %d is deleted\n"), partnum + 1);
+ if (fdisk_delete_partition(cxt, partnum) != 0)
+ printf(_("Could not delete partition %d\n"), partnum + 1);
+ else
+ printf(_("Partition %d is deleted\n"), partnum + 1);
}
static void change_partition_type(struct fdisk_context *cxt)