1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Check for alloc error

Simplify segtype_str usage and check for NULL segtype.
This commit is contained in:
Zdenek Kabelac 2012-03-01 21:21:54 +00:00
parent f996955304
commit a75b0d4ee6
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.94 -
====================================
Check for alloc fail from get_segtype_from_string() in _lvcreate_params().
Add _rimage as reserved suffix to lvm.8 man page.
Improve error logging from mpath filter.
Check for allocation failure in hold_lock() in clvmd.

View File

@ -652,10 +652,13 @@ static int _lvcreate_params(struct lvcreate_params *lp,
else
segtype_str = "striped";
lp->segtype = get_segtype_from_string(cmd, arg_str_value(cmd, type_ARG, segtype_str));
segtype_str = arg_str_value(cmd, type_ARG, segtype_str);
if (!(lp->segtype = get_segtype_from_string(cmd, segtype_str)))
return_0;
if (seg_unknown(lp)) {
log_error("Unable to create LV with unknown segment type %s.", arg_str_value(cmd, type_ARG, segtype_str));
log_error("Unable to create LV with unknown segment type %s.", segtype_str);
return 0;
}