summaryrefslogtreecommitdiffstats
path: root/libdm/libdm-config.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2012-02-28 17:46:47 +0000
committerAlasdair Kergon <agk@redhat.com>2012-02-28 17:46:47 +0000
commitebf5552754bdf0d4c04f45bef334799775776ad7 (patch)
treef7a2789afbed7f1c95c4e5bf1561481b481f5918 /libdm/libdm-config.c
parentc682e83760291080a7b0b25be1a1b422e1c8a6e0 (diff)
downloadlvm2-ebf5552754bdf0d4c04f45bef334799775776ad7.tar.gz
lvm2-ebf5552754bdf0d4c04f45bef334799775776ad7.tar.xz
lvm2-ebf5552754bdf0d4c04f45bef334799775776ad7.zip
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.
Diffstat (limited to 'libdm/libdm-config.c')
-rw-r--r--libdm/libdm-config.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index 97559171..cd71f4e4 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -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);
- /* Empty strings are ignored */
- if ((n && n->v && n->v->type == DM_CFG_STRING) &&
- (allow_empty || (*n->v->v.str))) {
- log_very_verbose("Setting %s to %s", path, n->v->v.str);
- return n->v->v.str;
- } else if (n && (!n->v || (n->v->type != DM_CFG_STRING) ||
- (!allow_empty && fail)))
- log_warn("WARNING: Ignoring unsupported value for %s.", path);
+ /* Empty strings are ignored if allow_empty is set */
+ if (n && n->v) {
+ if ((n->v->type == DM_CFG_STRING) &&
+ (allow_empty || (*n->v->v.str))) {
+ log_very_verbose("Setting %s to %s", path, n->v->v.str);
+ return n->v->v.str;
+ }
+ if ((n->v->type != DM_CFG_STRING) || (!allow_empty && fail))
+ log_warn("WARNING: Ignoring unsupported value for %s.", path);
+ }
if (fail)
log_very_verbose("%s not found in config: defaulting to %s",