diff options
author | Davidlohr Bueso | 2012-11-26 05:29:18 +0100 |
---|---|---|
committer | Karel Zak | 2012-11-30 13:48:27 +0100 |
commit | 8254c3a59480c2727ae8d3a903e16a0d9fac0a8b (patch) | |
tree | 787d4b786bdd723d1718268242a38163402fb75f /fdisks/fdisksunlabel.c | |
parent | fdisk: remove dead code (diff) | |
download | kernel-qcow2-util-linux-8254c3a59480c2727ae8d3a903e16a0d9fac0a8b.tar.gz kernel-qcow2-util-linux-8254c3a59480c2727ae8d3a903e16a0d9fac0a8b.tar.xz kernel-qcow2-util-linux-8254c3a59480c2727ae8d3a903e16a0d9fac0a8b.zip |
fdisk: api: propagate add partitions to users
Similarly to commit 1f5eb51b79275e32d045fd6718753bf04cde8374 we
do not propagate problems when adding partitions to user visible
api.
Signed-off-by: Davidlohr Bueso <dave@gnu.org>
Diffstat (limited to 'fdisks/fdisksunlabel.c')
-rw-r--r-- | fdisks/fdisksunlabel.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/fdisks/fdisksunlabel.c b/fdisks/fdisksunlabel.c index 01be5e8da..5bb141d3b 100644 --- a/fdisks/fdisksunlabel.c +++ b/fdisks/fdisksunlabel.c @@ -364,8 +364,8 @@ static int sun_verify_disklabel(struct fdisk_context *cxt) return 0; } -static void sun_add_partition(struct fdisk_context *cxt, int n, - struct fdisk_parttype *t) +static int sun_add_partition(struct fdisk_context *cxt, int n, + struct fdisk_parttype *t) { uint32_t starts[SUN_NUM_PARTITIONS], lens[SUN_NUM_PARTITIONS]; struct sun_partition *part = &sunlabel->partitions[n]; @@ -380,7 +380,7 @@ static void sun_add_partition(struct fdisk_context *cxt, int n, if (part->num_sectors && tag->tag != SSWAP16(SUN_TAG_UNASSIGNED)) { printf(_("Partition %d is already defined. Delete " "it before re-adding it.\n"), n + 1); - return; + return -EINVAL; } fetch_sun(cxt, starts, lens, &start, &stop); @@ -391,7 +391,7 @@ static void sun_add_partition(struct fdisk_context *cxt, int n, else { printf(_("Other partitions already cover the whole disk.\nDelete " "some/shrink them before retry.\n")); - return; + return -EINVAL; } } snprintf(mesg, sizeof(mesg), _("First %s"), str_units(SINGULAR)); @@ -484,6 +484,7 @@ and is of type `Whole disk'\n")); sys = SUN_TAG_BACKUP; set_sun_partition(cxt, n, first, last, sys); + return 0; } static int sun_delete_partition(struct fdisk_context *cxt, int partnum) |