]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use correct arguments to dict_addattr()
authorAlan T. DeKok <aland@freeradius.org>
Sun, 17 Mar 2013 15:29:48 +0000 (11:29 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sun, 17 Mar 2013 15:29:48 +0000 (11:29 -0400)
and update the messages to be more consistent

src/modules/rlm_counter/rlm_counter.c

index e879fefbd9a54a66b2c8f5b75c3f2319402843e9..47c128e9bfe014be9598cc1d7ac9d19cb8d53bfb 100644 (file)
@@ -414,10 +414,15 @@ static int counter_instantiate(CONF_SECTION *conf, void **instance)
        }
 
        memset(&flags, 0, sizeof(flags));
-       dict_addattr(inst->counter_name, -1, 0, PW_TYPE_INTEGER, flags);
+       if (dict_addattr(inst->counter_name, -1, 0, PW_TYPE_INTEGER, flags) < 0) {
+               radlog(L_ERR, "rlm_counter: Failed to create counter attribute %s: %s",
+                      inst->counter_name, fr_strerror());
+               return -1;
+       }
+
        dattr = dict_attrbyname(inst->counter_name);
        if (dattr == NULL) {
-               radlog(L_ERR, "rlm_counter: Failed to create counter attribute %s",
+               radlog(L_ERR, "rlm_counter: Failed to find counter attribute %s",
                                inst->counter_name);
                return -1;
        }
@@ -432,10 +437,15 @@ static int counter_instantiate(CONF_SECTION *conf, void **instance)
                radlog(L_ERR, "rlm_counter: 'check-name' must be set.");
                return -1;
        }
-       dict_addattr(inst->check_name, 0, PW_TYPE_INTEGER, -1, flags);
+       if (dict_addattr(inst->check_name, -1, 0, PW_TYPE_INTEGER, flags) < 0) {
+               radlog(L_ERR, "rlm_counter: Failed to create check attribute %s: %s",
+                      inst->counter_name, fr_strerror());
+               return -1;
+
+       }
        dattr = dict_attrbyname(inst->check_name);
        if (dattr == NULL) {
-               radlog(L_ERR, "rlm_counter: Failed to create check attribute %s",
+               radlog(L_ERR, "rlm_counter: Failed to find check attribute %s",
                                inst->counter_name);
                return -1;
        }