1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-26 08:55:06 +03:00

export: add missed buffer initialization

Since we reduced emitting to single string list,
we need to make sure empty list are not producing
garbage strings.
This commit is contained in:
Zdenek Kabelac 2024-10-23 14:38:21 +02:00
parent 056ad4a8f4
commit ea39c58127
2 changed files with 6 additions and 0 deletions

View File

@ -394,6 +394,8 @@ static char *_alloc_printed_str_list(struct dm_list *list)
return NULL;
}
buffer[0];
dm_list_iterate_items(sl, list) {
if (!emit_to_buffer(&buf, &size, "%s\"%s\"",
(!first) ? ", " : "",
@ -839,6 +841,7 @@ static int _alloc_printed_indirect_descendants(struct dm_list *indirect_glvs, ch
return 0;
}
buf = *buffer;
buf[0] = 0;
dm_list_iterate_items(user_glvl, indirect_glvs) {
if (user_glvl->glv->is_historical)

View File

@ -145,6 +145,9 @@ int print_flags(char *buffer, size_t size, enum pv_vg_lv_e type, int mask, uint6
if (!(flags = _get_flags(type)))
return_0;
if (size)
buffer[0] = 0;
for (f = 0; flags[f].mask; f++) {
if (status & flags[f].mask) {
status &= ~flags[f].mask;