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

Fix empty string warning logic in _find_config_str. (1.02.68)

pvcreate gives
WARNING: Ignoring unsupported value for metadata/pvmetadataignore.

It was warning if there is no config file entry instead of only if the node
exists but is empty.
This commit is contained in:
Alasdair Kergon 2012-02-28 17:46:47 +00:00
parent 505c0cbb2e
commit 7a3de26248
2 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.73 - Version 1.02.73 -
==================================== ====================================
Fix empty string warning logic in _find_config_str. (1.02.68)
Fix dm_task_set_name to properly resolve path to dm name (1.02.71). Fix dm_task_set_name to properly resolve path to dm name (1.02.71).
Add dm_strncpy() function as a faster strncpy() replacement. Add dm_strncpy() function as a faster strncpy() replacement.

View File

@ -751,14 +751,16 @@ static const char *_find_config_str(const void *start, node_lookup_fn find_fn,
{ {
const struct dm_config_node *n = find_fn(start, path); const struct dm_config_node *n = find_fn(start, path);
/* Empty strings are ignored */ /* Empty strings are ignored if allow_empty is set */
if ((n && n->v && n->v->type == DM_CFG_STRING) && if (n && n->v) {
if ((n->v->type == DM_CFG_STRING) &&
(allow_empty || (*n->v->v.str))) { (allow_empty || (*n->v->v.str))) {
log_very_verbose("Setting %s to %s", path, n->v->v.str); log_very_verbose("Setting %s to %s", path, n->v->v.str);
return n->v->v.str; return n->v->v.str;
} else if (n && (!n->v || (n->v->type != DM_CFG_STRING) || }
(!allow_empty && fail))) if ((n->v->type != DM_CFG_STRING) || (!allow_empty && fail))
log_warn("WARNING: Ignoring unsupported value for %s.", path); log_warn("WARNING: Ignoring unsupported value for %s.", path);
}
if (fail) if (fail)
log_very_verbose("%s not found in config: defaulting to %s", log_very_verbose("%s not found in config: defaulting to %s",