From e35f3c5c634216860f14586a7d17232022d8b588 Mon Sep 17 00:00:00 2001 From: Mike Flisher Date: Sun, 22 May 2011 17:39:29 +0200 Subject: [PATCH] Various plugins: Set the cURL option "CURLOPT_NOSIGNAL". This fixes problems with version 7.21.2 (and later) of libcurl that are due to collectd being a multi-threaded program. Signed-off-by: Florian Forster --- src/apache.c | 1 + src/ascent.c | 1 + src/bind.c | 1 + src/curl.c | 1 + src/curl_json.c | 1 + src/curl_xml.c | 1 + src/nginx.c | 1 + src/write_http.c | 1 + 8 files changed, 8 insertions(+) diff --git a/src/apache.c b/src/apache.c index 3d6d957c..5f5441ff 100644 --- a/src/apache.c +++ b/src/apache.c @@ -406,6 +406,7 @@ static int init_host (apache_t *st) /* {{{ */ return (-1); } + curl_easy_setopt (st->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (st->curl, CURLOPT_WRITEFUNCTION, apache_curl_callback); curl_easy_setopt (st->curl, CURLOPT_WRITEDATA, st); diff --git a/src/ascent.c b/src/ascent.c index 6782fce1..993e480c 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -539,6 +539,7 @@ static int ascent_init (void) /* {{{ */ return (-1); } + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, ascent_curl_callback); curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, ascent_curl_error); diff --git a/src/bind.c b/src/bind.c index 6e0b907f..6e13a8be 100644 --- a/src/bind.c +++ b/src/bind.c @@ -1382,6 +1382,7 @@ static int bind_init (void) /* {{{ */ return (-1); } + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, bind_curl_callback); curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error); diff --git a/src/curl.c b/src/curl.c index a533e147..31cda39a 100644 --- a/src/curl.c +++ b/src/curl.c @@ -370,6 +370,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ return (-1); } + curl_easy_setopt (wp->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (wp->curl, CURLOPT_WRITEFUNCTION, cc_curl_callback); curl_easy_setopt (wp->curl, CURLOPT_WRITEDATA, wp); curl_easy_setopt (wp->curl, CURLOPT_USERAGENT, diff --git a/src/curl_json.c b/src/curl_json.c index 248b91b5..55d4cd53 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -535,6 +535,7 @@ static int cj_init_curl (cj_t *db) /* {{{ */ return (-1); } + curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cj_curl_callback); curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db); curl_easy_setopt (db->curl, CURLOPT_USERAGENT, diff --git a/src/curl_xml.c b/src/curl_xml.c index c10955cb..61b5aded 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -734,6 +734,7 @@ static int cx_init_curl (cx_t *db) /* {{{ */ return (-1); } + curl_easy_setopt (db->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (db->curl, CURLOPT_WRITEFUNCTION, cx_curl_callback); curl_easy_setopt (db->curl, CURLOPT_WRITEDATA, db); curl_easy_setopt (db->curl, CURLOPT_USERAGENT, diff --git a/src/nginx.c b/src/nginx.c index 69768427..d9529516 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -119,6 +119,7 @@ static int init (void) return (-1); } + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, nginx_curl_callback); curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, nginx_curl_error); diff --git a/src/write_http.c b/src/write_http.c index ab8757ed..22b5842a 100644 --- a/src/write_http.c +++ b/src/write_http.c @@ -111,6 +111,7 @@ static int wh_callback_init (wh_callback_t *cb) /* {{{ */ return (-1); } + curl_easy_setopt (cb->curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (cb->curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); headers = NULL; -- 2.11.0