From: Alan T. DeKok Date: Sun, 17 Mar 2013 15:29:48 +0000 (-0400) Subject: Use correct arguments to dict_addattr() X-Git-Tag: release_3_0_0_beta1~707 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8dc8d69d18be0882b866f8c253ca7bf4cc9f8630;p=thirdparty%2Ffreeradius-server.git Use correct arguments to dict_addattr() and update the messages to be more consistent --- diff --git a/src/modules/rlm_counter/rlm_counter.c b/src/modules/rlm_counter/rlm_counter.c index e879fefbd9a..47c128e9bfe 100644 --- a/src/modules/rlm_counter/rlm_counter.c +++ b/src/modules/rlm_counter/rlm_counter.c @@ -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; }