From f59691501672c4589b49d11fc1865b6893874bb4 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 10 Jun 2015 07:55:02 +0100 Subject: [PATCH] src/configfile.c: Set a plugin context when autoloading plugins. Fixes: #1069 --- src/configfile.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/configfile.c b/src/configfile.c index ec39b760..d61bc88f 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -384,9 +384,19 @@ static int dispatch_block_plugin (oconfig_item_t *ci) if (IS_TRUE (global_option_get ("AutoLoadPlugin"))) { + plugin_ctx_t ctx; + plugin_ctx_t old_ctx; int status; + /* default to the global interval set before loading this plugin */ + memset (&ctx, 0, sizeof (ctx)); + ctx.interval = cf_get_default_interval (); + + old_ctx = plugin_set_ctx (ctx); status = plugin_load (name, /* flags = */ 0); + /* reset to the "global" context */ + plugin_set_ctx (old_ctx); + if (status != 0) { ERROR ("Automatically loading plugin \"%s\" failed " -- 2.30.2