Code

src/plugin.c: If the pre-cache chain returns `stop', dont update the cache.
authorFlorian Forster <octo@huhu.verplant.org>
Wed, 4 Feb 2009 16:47:41 +0000 (17:47 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Wed, 4 Feb 2009 16:47:41 +0000 (17:47 +0100)
Don't run the post-cache chain, either.

src/plugin.c

index fa1d2718357caa7ae82b9e39f89598590ff69deb..95b9fa37948dde97d65bbb06e5a05b8cd63162c8 100644 (file)
@@ -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);