From: Marc Fournier Date: Sat, 4 Apr 2015 23:16:13 +0000 (+0200) Subject: make sure CURLOPT_TIMEOUT_MS only gets longs X-Git-Tag: collectd-5.5.0~56^2 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=6466bdb79c1f36b9f2867b92605928ddc39d0605 make sure CURLOPT_TIMEOUT_MS only gets longs ... to avoid portability problems. --- diff --git a/src/apache.c b/src/apache.c index 9e91b802..0d915b07 100644 --- a/src/apache.c +++ b/src/apache.c @@ -373,7 +373,7 @@ static int init_host (apache_t *st) /* {{{ */ curl_easy_setopt (st->curl, CURLOPT_CAINFO, st->cacert); if (st->timeout >= 0) - curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, st->timeout); + curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) st->timeout); else curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, CDTIME_T_TO_MS(plugin_get_interval())); diff --git a/src/ascent.c b/src/ascent.c index 66640d99..501f294f 100644 --- a/src/ascent.c +++ b/src/ascent.c @@ -591,7 +591,7 @@ static int ascent_init (void) /* {{{ */ curl_easy_setopt (curl, CURLOPT_CAINFO, cacert); if (timeout != NULL) - curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atoi(timeout)); + curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atol(timeout)); else curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, CDTIME_T_TO_MS(plugin_get_interval())); diff --git a/src/bind.c b/src/bind.c index c36cf482..9a4b6391 100644 --- a/src/bind.c +++ b/src/bind.c @@ -1728,7 +1728,7 @@ static int bind_init (void) /* {{{ */ curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L); curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, (timeout >= 0) ? - timeout : CDTIME_T_TO_MS(plugin_get_interval())); + (long) timeout : CDTIME_T_TO_MS(plugin_get_interval())); return (0); diff --git a/src/curl.c b/src/curl.c index 893cc54c..1bbeddc7 100644 --- a/src/curl.c +++ b/src/curl.c @@ -412,7 +412,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */ curl_easy_setopt (wp->curl, CURLOPT_POSTFIELDS, wp->post_body); if (wp->timeout >= 0) - curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, wp->timeout); + curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, (long) wp->timeout); else curl_easy_setopt (wp->curl, CURLOPT_TIMEOUT_MS, CDTIME_T_TO_MS(plugin_get_interval())); diff --git a/src/curl_json.c b/src/curl_json.c index 292b262c..5128c874 100644 --- a/src/curl_json.c +++ b/src/curl_json.c @@ -652,7 +652,7 @@ static int cj_init_curl (cj_t *db) /* {{{ */ curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body); if (db->timeout >= 0) - curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, db->timeout); + curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) db->timeout); else if (db->interval > 0) curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, CDTIME_T_TO_MS(db->timeout)); diff --git a/src/curl_xml.c b/src/curl_xml.c index c67d9a3a..32a48c51 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -886,7 +886,7 @@ static int cx_init_curl (cx_t *db) /* {{{ */ curl_easy_setopt (db->curl, CURLOPT_POSTFIELDS, db->post_body); if (db->timeout >= 0) - curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, db->timeout); + curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, (long) db->timeout); else curl_easy_setopt (db->curl, CURLOPT_TIMEOUT_MS, CDTIME_T_TO_MS(plugin_get_interval())); diff --git a/src/nginx.c b/src/nginx.c index edb55b9e..1c537a85 100644 --- a/src/nginx.c +++ b/src/nginx.c @@ -183,7 +183,7 @@ static int init (void) if (timeout != NULL) { - curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atoi(timeout)); + curl_easy_setopt (curl, CURLOPT_TIMEOUT_MS, atol(timeout)); } else {