diff options
author | Alasdair Kergon <agk@redhat.com> | 2009-06-03 11:40:23 +0000 |
---|---|---|
committer | Alasdair Kergon <agk@redhat.com> | 2009-06-03 11:40:23 +0000 |
commit | c9ee46569cea8cac4d32677c4fde7d979f1e36ee (patch) | |
tree | bdef661ef08f4b6b9719e46ed3bbf4fbe1d25f2d /libdm | |
parent | b6deac338f67172486f3ed8eabdc1d7798d2df37 (diff) | |
download | lvm2-c9ee46569cea8cac4d32677c4fde7d979f1e36ee.tar.gz |
Make mempool optional in dm_split_lvm_name()
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/libdevmapper.h | 2 | ||||
-rw-r--r-- | libdm/libdm-string.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h index a6e253008..c8ce21f64 100644 --- a/libdm/libdevmapper.h +++ b/libdm/libdevmapper.h @@ -819,6 +819,8 @@ int dm_set_selinux_context(const char *path, mode_t mode); /* * Break up the name of a mapped device into its constituent * Volume Group, Logical Volume and Layer (if present). + * If mem is supplied, the result is allocated from the mempool. + * Otherwise the strings are changed in situ. */ int dm_split_lvm_name(struct dm_pool *mem, const char *dmname, char **vgname, char **lvname, char **layer); diff --git a/libdm/libdm-string.c b/libdm/libdm-string.c index 0e41f9d9d..c6f101bcc 100644 --- a/libdm/libdm-string.c +++ b/libdm/libdm-string.c @@ -93,7 +93,7 @@ static char *_unquote(char *component) int dm_split_lvm_name(struct dm_pool *mem, const char *dmname, char **vgname, char **lvname, char **layer) { - if (!(*vgname = dm_pool_strdup(mem, dmname))) + if (mem && !(*vgname = dm_pool_strdup(mem, dmname))) return 0; _unquote(*layer = _unquote(*lvname = _unquote(*vgname))); |