]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
move error message to caller, as it sometimes may be suppressed
authorAlan T. DeKok <aland@freeradius.org>
Mon, 19 Jun 2017 19:50:09 +0000 (15:50 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 19 Jun 2017 19:50:09 +0000 (15:50 -0400)
src/main/cf_parse.c
src/main/cf_util.c

index 932cc729412bec22cc54e23b541e097997e50d71..c3fb3364948bcb9f0573a85e3c2218c59ab917da 100644 (file)
@@ -1327,9 +1327,11 @@ int _cf_section_rule_push(CONF_SECTION *cs, CONF_PARSER const *rule, char const
         *      Fixme maybe?.. Can't have a section and pair with the same name.
         */
        if (!_cf_data_add_static(CF_TO_ITEM(cs), rule, "CONF_PARSER", rule->name, filename, lineno)) {
+               CONF_DATA const *cd;
                CONF_PARSER const *old;
 
-               old = cf_data_value(cf_data_find(CF_TO_ITEM(cs), CONF_PARSER, rule->name));
+               cd = cf_data_find(CF_TO_ITEM(cs), CONF_PARSER, rule->name);
+               old = cf_data_value(cd);
                rad_assert(old != NULL);
 
                /*
@@ -1339,6 +1341,9 @@ int _cf_section_rule_push(CONF_SECTION *cs, CONF_PARSER const *rule, char const
                        return 0;
                }
 
+               cf_log_err(cs, "Data of type %s with name \"%s\" already exists.  Existing data added %s[%i]", "CONF_PARSER",
+                          rule->name, cd->item.filename, cd->item.lineno);
+
                cf_debug(cs);
                return -1;
        }
index 2820e5b8c5a76f3117113131143a8b9717a67015..6658b34752619c45d4f279b625947a86c2fa4838 100644 (file)
@@ -1364,8 +1364,6 @@ CONF_DATA const *_cf_data_add(CONF_ITEM *ci, void const *data, char const *name,
         */
        found = _cf_data_find(ci, type, name);
        if (found) {
-               cf_log_err(ci, "Data of type %s with name \"%s\" already exists.  Existing data added %s[%i]", type,
-                          name, found->item.filename, found->item.lineno);
                return NULL;
        }