summaryrefslogtreecommitdiffstats
path: root/fdisks/fdiskbsdlabel.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/fdiskbsdlabel.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/fdiskbsdlabel.c')
-rw-r--r--fdisks/fdiskbsdlabel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fdisks/fdiskbsdlabel.c b/fdisks/fdiskbsdlabel.c
index af7513f5e..e8bd78884 100644
--- a/fdisks/fdiskbsdlabel.c
+++ b/fdisks/fdiskbsdlabel.c
@@ -61,7 +61,7 @@
#define DKTYPENAMES
#include "fdiskbsdlabel.h"
-static void xbsd_delete_part (struct fdisk_context *cxt, int partnum);
+static int xbsd_delete_part (struct fdisk_context *cxt, int partnum);
static void xbsd_edit_disklabel (void);
static void xbsd_write_bootstrap (struct fdisk_context *cxt);
static void xbsd_change_fstype (struct fdisk_context *cxt);
@@ -311,7 +311,7 @@ bsd_command_prompt (struct fdisk_context *cxt)
}
}
-static void xbsd_delete_part(struct fdisk_context *cxt __attribute__((__unused__)),
+static int xbsd_delete_part(struct fdisk_context *cxt __attribute__((__unused__)),
int partnum)
{
xbsd_dlabel.d_partitions[partnum].p_size = 0;
@@ -320,6 +320,8 @@ static void xbsd_delete_part(struct fdisk_context *cxt __attribute__((__unused__
if (xbsd_dlabel.d_npartitions == partnum + 1)
while (!xbsd_dlabel.d_partitions[xbsd_dlabel.d_npartitions-1].p_size)
xbsd_dlabel.d_npartitions--;
+
+ return 0;
}
void