1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

raid: check result of get_segtype_from_string

Error here is rather highly unpexpected for these types, but
stay consistent with rest of the code and don't use unchecked value.
This commit is contained in:
Zdenek Kabelac 2014-09-12 11:48:51 +02:00
parent 08bde75093
commit 40b7b107b1

View File

@ -362,7 +362,9 @@ static int _alloc_image_component(struct logical_volume *lv,
return 0;
}
segtype = get_segtype_from_string(lv->vg->cmd, "striped");
if (!(segtype = get_segtype_from_string(lv->vg->cmd, "striped")))
return_0;
if (!lv_add_segment(ah, first_area, 1, tmp_lv, segtype, 0, status, 0)) {
log_error("Failed to add segment to LV, %s", img_name);
return 0;
@ -833,7 +835,8 @@ static int _raid_extract_images(struct logical_volume *lv, uint32_t new_count,
if (!lvl_array)
return_0;
error_segtype = get_segtype_from_string(lv->vg->cmd, "error");
if (!(error_segtype = get_segtype_from_string(lv->vg->cmd, "error")))
return_0;
/*
* We make two passes over the devices.