From: Michael Salmon Date: Thu, 16 Jul 2015 07:05:54 +0000 (+0200) Subject: threshold plugin: Register callbacks only once. X-Git-Tag: collectd-5.5.1~31^2~9 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=74fa9577b1acbb965488aa0a48c140d8ece437bf;p=collectd.git threshold plugin: Register callbacks only once. Fixes: #551 Signed-off-by: Florian Forster --- diff --git a/src/threshold.c b/src/threshold.c index 391ee932..a70ec8af 100644 --- a/src/threshold.c +++ b/src/threshold.c @@ -962,6 +962,7 @@ int ut_config (oconfig_item_t *ci) { /* {{{ */ int i; int status = 0; + int old_size = c_avl_size (threshold_tree); threshold_t th; @@ -1005,7 +1006,9 @@ int ut_config (oconfig_item_t *ci) break; } - if (c_avl_size (threshold_tree) > 0) { + /* register callbacks if this is the first time we see a valid config */ + if ((old_size == 0) && (c_avl_size (threshold_tree) > 0)) + { plugin_register_missing ("threshold", ut_missing, /* user data = */ NULL); plugin_register_write ("threshold", ut_check_threshold,