summaryrefslogtreecommitdiff
path: root/liblvm/lvm_lv.c
diff options
context:
space:
mode:
Diffstat (limited to 'liblvm/lvm_lv.c')
-rw-r--r--liblvm/lvm_lv.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index c535caf9d..f8ef2f16e 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -124,12 +124,18 @@ static void _lv_set_default_params(struct lvcreate_params *lp,
}
/* Set default for linear segment specific LV parameters */
-static void _lv_set_default_linear_params(struct cmd_context *cmd,
+static int _lv_set_default_linear_params(struct cmd_context *cmd,
struct lvcreate_params *lp)
{
- lp->segtype = get_segtype_from_string(cmd, "striped");
+ if (!(lp->segtype = get_segtype_from_string(cmd, "striped"))) {
+ log_error(INTERNAL_ERROR "Segtype striped not found.");
+ return 0;
+ }
+
lp->stripes = 1;
lp->stripe_size = DEFAULT_STRIPESIZE * 2;
+
+ return 1;
}
/*
@@ -151,7 +157,8 @@ lv_t lvm_vg_create_lv_linear(vg_t vg, const char *name, uint64_t size)
extents = extents_from_size(vg->cmd, size / SECTOR_SIZE,
vg->extent_size);
_lv_set_default_params(&lp, vg, name, extents);
- _lv_set_default_linear_params(vg->cmd, &lp);
+ if (!_lv_set_default_linear_params(vg->cmd, &lp))
+ return_NULL;
if (!lv_create_single(vg, &lp))
return NULL;
lvl = find_lv_in_vg(vg, name);