From 6466bdb79c1f36b9f2867b92605928ddc39d0605 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Sun, 5 Apr 2015 01:16:13 +0200 Subject: [PATCH] make sure CURLOPT_TIMEOUT_MS only gets longs ... to avoid portability problems. --- src/apache.c | 2 +- src/ascent.c | 2 +- src/bind.c | 2 +- src/curl.c | 2 +- src/curl_json.c | 2 +- src/curl_xml.c | 2 +- src/nginx.c | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) 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 { -- 2.30.2