]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/collectd/0007-apache-plugin-Call-curl_global_init-from-the-init-fu.patch
Merge branch 'master' into next
[ipfire-2.x.git] / src / patches / collectd / 0007-apache-plugin-Call-curl_global_init-from-the-init-fu.patch
1 From 5f2f969335757f31f42cd8bb7e38eb8c5fe5e56e Mon Sep 17 00:00:00 2001
2 From: Florian Forster <octo@collectd.org>
3 Date: Wed, 15 Jan 2014 23:47:33 +0100
4 Subject: [PATCH 07/22] apache plugin: Call curl_global_init() from the init
5 function.
6
7 This is a shot in the dark in trying to address #513. By calling this
8 from an init() callback, I hope to be initializing the curl and gcrypt
9 libraries before collectd becomes multi-threaded, avoiding the problems
10 described in the issue.
11 ---
12 src/apache.c | 9 +++++++++
13 1 file changed, 9 insertions(+)
14
15 diff --git a/src/apache.c b/src/apache.c
16 index 899c21e..23bba3e 100644
17 --- a/src/apache.c
18 +++ b/src/apache.c
19 @@ -702,9 +702,18 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
20 return (0);
21 } /* }}} int apache_read_host */
22
23 +static int apache_init (void) /* {{{ */
24 +{
25 + /* Call this while collectd is still single-threaded to avoid
26 + * initialization issues in libgcrypt. */
27 + curl_global_init (CURL_GLOBAL_SSL);
28 + return (0);
29 +} /* }}} int apache_init */
30 +
31 void module_register (void)
32 {
33 plugin_register_complex_config ("apache", config);
34 + plugin_register_init ("apache", apache_init);
35 } /* void module_register */
36
37 /* vim: set sw=8 noet fdm=marker : */
38 --
39 1.9.3
40