From 48cd5de0dddc1f974da5a6e12ba4ede38ff786c6 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 4 Feb 2009 17:47:41 +0100 Subject: [PATCH] src/plugin.c: If the pre-cache chain returns `stop', dont update the cache. Don't run the post-cache chain, either. --- src/plugin.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/plugin.c b/src/plugin.c index fa1d2718..95b9fa37 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -844,6 +844,7 @@ void plugin_shutdown_all (void) int plugin_dispatch_values (value_list_t *vl) { + int status; static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC; data_set_t *ds; @@ -910,13 +911,33 @@ int plugin_dispatch_values (value_list_t *vl) escape_slashes (vl->type_instance, sizeof (vl->type_instance)); if (pre_cache_chain != NULL) - fc_process_chain (ds, vl, pre_cache_chain); + { + status = fc_process_chain (ds, vl, pre_cache_chain); + if (status < 0) + { + WARNING ("plugin_dispatch_values: Running the " + "pre-cache chain failed with " + "status %i (%#x).", + status, status); + } + else if (status == FC_TARGET_STOP) + return (0); + } /* Update the value cache */ uc_update (ds, vl); if (post_cache_chain != NULL) - fc_process_chain (ds, vl, post_cache_chain); + { + status = fc_process_chain (ds, vl, post_cache_chain); + if (status < 0) + { + WARNING ("plugin_dispatch_values: Running the " + "post-cache chain failed with " + "status %i (%#x).", + status, status); + } + } else fc_default_action (ds, vl); -- 2.30.2