Module: kamailio
Branch: master
Commit: 5b00ef8bb31fb029b2d4dedae40e2c7a54841fe6
URL:
https://github.com/kamailio/kamailio/commit/5b00ef8bb31fb029b2d4dedae40e2c7…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2018-01-05T09:08:56+01:00
snmpstats: check the return code when registering statistics
---
Modified: src/modules/snmpstats/snmpstats.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5b00ef8bb31fb029b2d4dedae40e2c7…
Patch:
https://github.com/kamailio/kamailio/commit/5b00ef8bb31fb029b2d4dedae40e2c7…
---
diff --git a/src/modules/snmpstats/snmpstats.c b/src/modules/snmpstats/snmpstats.c
index 4bd11c98d2..9a8acea270 100644
--- a/src/modules/snmpstats/snmpstats.c
+++ b/src/modules/snmpstats/snmpstats.c
@@ -302,10 +302,14 @@ static int register_message_code_statistics(void)
sizeof(stat_var *) * number_of_message_codes);
for(i = 0; i < number_of_message_codes; i++) {
- register_stat(SNMPSTATS_MODULE_NAME, in_message_code_names[i],
- &in_message_code_stats[i], 0);
- register_stat(SNMPSTATS_MODULE_NAME, out_message_code_names[i],
- &out_message_code_stats[i], 0);
+ if(register_stat(SNMPSTATS_MODULE_NAME, in_message_code_names[i],
+ &in_message_code_stats[i], 0)!=0) {
+ LM_ERR("failed to register in_message_code_names[%d]\n", i);
+ }
+ if(register_stat(SNMPSTATS_MODULE_NAME, out_message_code_names[i],
+ &out_message_code_stats[i], 0)!=0) {
+ LM_ERR("failed to register out_message_code_names[%d]\n", i);
+ }
}
return 0;