From 0050480c0eced1da98ffc76d5010cef605c776eb Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Thu, 20 Nov 2014 16:18:22 +0100 Subject: [PATCH] libdm-config: Warn about duplicate keys. --- libdm/libdm-config.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c index e99ae267e..93e28872a 100644 --- a/libdm/libdm-config.c +++ b/libdm/libdm-config.c @@ -523,6 +523,7 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node * /* IDENTIFIER SECTION_B_CHAR VALUE* SECTION_E_CHAR */ struct dm_config_node *root, *n, *l = NULL; + struct dm_config_value *value; char *str; if (p->t == TOK_STRING_ESCAPED) { @@ -560,8 +561,12 @@ static struct dm_config_node *_section(struct parser *p, struct dm_config_node * match(TOK_SECTION_E); } else { match(TOK_EQ); - if (!(root->v = _value(p))) + if (!(value = _value(p))) return_NULL; + if (root->v) + log_warn("WARNING: Ignoring duplicate" + " config value: %s", str); + root->v = value; } return root;