From: Florian Forster Date: Wed, 10 Jun 2015 06:55:02 +0000 (+0100) Subject: src/configfile.c: Set a plugin context when autoloading plugins. X-Git-Tag: collectd-5.5.1~116^2~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f59691501672c4589b49d11fc1865b6893874bb4;p=collectd.git src/configfile.c: Set a plugin context when autoloading plugins. Fixes: #1069 --- 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 "