1 From 66b400ab01b8133e450bb002e175117a1ab6f9ae Mon Sep 17 00:00:00 2001
2 From: Jeremy Katz <jeremy@katzbox.net>
3 Date: Sun, 26 Jan 2014 20:43:19 -0500
4 Subject: [PATCH 09/22] Call curl_global_init() in _init of plugins using curl
6 Need to call curl_global_init() or curl_easy_init() during init
7 for plugins when we're still running single threaded. This
8 updates the remaining ones
11 src/curl_json.c | 9 +++++++++
12 src/curl_xml.c | 9 +++++++++
13 src/write_http.c | 9 +++++++++
14 4 files changed, 28 insertions(+)
16 diff --git a/src/curl.c b/src/curl.c
17 index 3899aaa..8d2893f 100644
20 @@ -566,6 +566,7 @@ static int cc_init (void) /* {{{ */
21 INFO ("curl plugin: No pages have been defined.");
24 + curl_global_init (CURL_GLOBAL_SSL);
26 } /* }}} int cc_init */
28 diff --git a/src/curl_json.c b/src/curl_json.c
29 index 24e1df1..0948962 100644
32 @@ -882,9 +882,18 @@ static int cj_read (user_data_t *ud) /* {{{ */
33 return cj_curl_perform (db, db->curl);
34 } /* }}} int cj_read */
36 +static int cj_init (void) /* {{{ */
38 + /* Call this while collectd is still single-threaded to avoid
39 + * initialization issues in libgcrypt. */
40 + curl_global_init (CURL_GLOBAL_SSL);
42 +} /* }}} int cj_init */
44 void module_register (void)
46 plugin_register_complex_config ("curl_json", cj_config);
47 + plugin_register_init ("curl_json", cj_init);
48 } /* void module_register */
50 /* vim: set sw=2 sts=2 et fdm=marker : */
51 diff --git a/src/curl_xml.c b/src/curl_xml.c
52 index b941f02..e31e73d 100644
55 @@ -926,9 +926,18 @@ static int cx_config (oconfig_item_t *ci) /* {{{ */
57 } /* }}} int cx_config */
59 +static int cx_init (void) /* {{{ */
61 + /* Call this while collectd is still single-threaded to avoid
62 + * initialization issues in libgcrypt. */
63 + curl_global_init (CURL_GLOBAL_SSL);
65 +} /* }}} int cx_init */
67 void module_register (void)
69 plugin_register_complex_config ("curl_xml", cx_config);
70 + plugin_register_init ("curl_xml", cx_init);
71 } /* void module_register */
73 /* vim: set sw=2 sts=2 et fdm=marker : */
74 diff --git a/src/write_http.c b/src/write_http.c
75 index 62c73b0..04c637b 100644
76 --- a/src/write_http.c
77 +++ b/src/write_http.c
78 @@ -656,9 +656,18 @@ static int wh_config (oconfig_item_t *ci) /* {{{ */
80 } /* }}} int wh_config */
82 +static int wh_init (void) /* {{{ */
84 + /* Call this while collectd is still single-threaded to avoid
85 + * initialization issues in libgcrypt. */
86 + curl_global_init (CURL_GLOBAL_SSL);
88 +} /* }}} int wh_init */
90 void module_register (void) /* {{{ */
92 plugin_register_complex_config ("write_http", wh_config);
93 + plugin_register_init ("write_http", wh_init);
94 } /* }}} void module_register */
96 /* vim: set fdm=marker sw=8 ts=8 tw=78 et : */