aboutsummaryrefslogtreecommitdiff
path: root/liblvm
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2013-06-18 15:13:27 -0400
committerTony Asleson <tasleson@redhat.com>2013-07-02 14:24:34 -0500
commit40feaa7bbeaca9a89f9b8e87b684c457cd10aa57 (patch)
treea535b59259c3d390e4d81256dfebc1adb8be5761 /liblvm
parent8882480083f9b4f769cc8756a2f641ae0452040d (diff)
downloadlvm2-40feaa7bbeaca9a89f9b8e87b684c457cd10aa57.tar.gz
python-lvm: Bug fixes from unit tests.
After the last rebase, existing unit test case was run which uncovered a number of errors that required attention. Uninitialized variables and changes to type of numeric return type were addressed. Signed-off-by: Tony Asleson <tasleson@redhat.com>
Diffstat (limited to 'liblvm')
-rw-r--r--liblvm/lvm_lv.c7
-rw-r--r--liblvm/lvm_vg.c11
2 files changed, 17 insertions, 1 deletions
diff --git a/liblvm/lvm_lv.c b/liblvm/lvm_lv.c
index 081c73edc..15bd813c5 100644
--- a/liblvm/lvm_lv.c
+++ b/liblvm/lvm_lv.c
@@ -611,7 +611,12 @@ lv_t lvm_lv_create(lv_create_params_t params)
}
if (!lv_create_single(params->vg, &params->lvp))
return_NULL;
- if (!(lvl = find_lv_in_vg(params->vg, params->lvp.lv_name)))
+
+ /* In some case we are making a thin pool so lv_name is not valid, but
+ * pool is.
+ */
+ if (!(lvl = find_lv_in_vg(params->vg,
+ (params->lvp.lv_name) ? params->lvp.lv_name : params->lvp.pool)))
return_NULL;
return (lv_t) lvl->lv;
}
diff --git a/liblvm/lvm_vg.c b/liblvm/lvm_vg.c
index a707589ac..955afdb32 100644
--- a/liblvm/lvm_vg.c
+++ b/liblvm/lvm_vg.c
@@ -345,6 +345,17 @@ struct lvm_property_value lvm_vg_get_property(const vg_t vg, const char *name)
int lvm_vg_set_property(const vg_t vg, const char *name,
struct lvm_property_value *value)
{
+ /* At this point it is unknown if all property set paths make the
+ * appropriate copy of the string. We will allocate a copy on the vg so
+ * that worst case we have two copies which will get freed when the vg gets
+ * released.
+ */
+
+ if (value->is_valid && value->is_string && value->value.string) {
+ value->value.string = dm_pool_strndup(vg->vgmem, value->value.string,
+ strlen(value->value.string) + 1);
+ }
+
return set_property(NULL, vg, NULL, NULL, name, value);
}