From: Florian Forster Date: Wed, 15 Jan 2014 22:47:33 +0000 (+0100) Subject: apache plugin: Call curl_global_init() from the init function. X-Git-Tag: collectd-5.4.1~1^2^2~1 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=5f2f969335757f31f42cd8bb7e38eb8c5fe5e56e apache plugin: Call curl_global_init() from the init function. This is a shot in the dark in trying to address #513. By calling this from an init() callback, I hope to be initializing the curl and gcrypt libraries before collectd becomes multi-threaded, avoiding the problems described in the issue. --- diff --git a/src/apache.c b/src/apache.c index 899c21ee..23bba3ea 100644 --- a/src/apache.c +++ b/src/apache.c @@ -702,9 +702,18 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */ return (0); } /* }}} int apache_read_host */ +static int apache_init (void) /* {{{ */ +{ + /* Call this while collectd is still single-threaded to avoid + * initialization issues in libgcrypt. */ + curl_global_init (CURL_GLOBAL_SSL); + return (0); +} /* }}} int apache_init */ + void module_register (void) { plugin_register_complex_config ("apache", config); + plugin_register_init ("apache", apache_init); } /* void module_register */ /* vim: set sw=8 noet fdm=marker : */