summaryrefslogtreecommitdiffstats
path: root/lib/datastruct/str_list.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2009-07-27 11:00:17 +0000
committerDave Wysochanski <dwysocha@redhat.com>2009-07-27 11:00:17 +0000
commit0589e19fd7d7ee1c864fa814845d2ed5f46fc15d (patch)
tree523635883b70eed1e7c6c9f87640698ccab5d679 /lib/datastruct/str_list.c
parentf6b1eaf7005f847e3230537feb47306d68b17b44 (diff)
downloadlvm2-0589e19fd7d7ee1c864fa814845d2ed5f46fc15d.tar.gz
lvm2-0589e19fd7d7ee1c864fa814845d2ed5f46fc15d.tar.xz
lvm2-0589e19fd7d7ee1c864fa814845d2ed5f46fc15d.zip
Update error return and comments for lvm_list_vg_names/uuids.
The two liblvm functions that return a list of vgnames and vguuids use cmd->mem to allocate the list. Make it clear to the caller that this memory will be freed when the LVM handle is freed. Clean up and clarify the return value of the functions. In the case of a memory allocation error, add a couple log_errnos to the internal code, and make it clear that memory allocation returns a NULL pointer. If there are no VGs in the system, the list returned is an empty list. Make a note of the fact that currently we return hidden VG names, how these can be detected (always start with "#"), and that they should not be used. Author: Dave Wysochanski <dwysocha@redhat.com>
Diffstat (limited to 'lib/datastruct/str_list.c')
-rw-r--r--lib/datastruct/str_list.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/datastruct/str_list.c b/lib/datastruct/str_list.c
index 14e33804..a6f061eb 100644
--- a/lib/datastruct/str_list.c
+++ b/lib/datastruct/str_list.c
@@ -20,8 +20,10 @@ struct dm_list *str_list_create(struct dm_pool *mem)
{
struct dm_list *sl;
- if (!(sl = dm_pool_alloc(mem, sizeof(struct dm_list))))
- return_NULL;
+ if (!(sl = dm_pool_alloc(mem, sizeof(struct dm_list)))) {
+ log_errno(ENOMEM, "str_list allocation failed");
+ return NULL;
+ }
dm_list_init(sl);