Merge branch 'collectd-4.10' into collectd-5.1
authorFlorian Forster <octo@collectd.org>
Sat, 16 Mar 2013 12:40:14 +0000 (13:40 +0100)
committerFlorian Forster <octo@collectd.org>
Sat, 16 Mar 2013 12:41:34 +0000 (13:41 +0100)
Conflicts:
src/curl_json.c

src/apache.c
src/ascent.c
src/bind.c
src/curl.c
src/curl_json.c
src/curl_xml.c
src/exec.c
src/mysql.c
src/nginx.c
src/write_http.c

index 202b73c..8458ce1 100644 (file)
@@ -426,6 +426,7 @@ static int init_host (apache_t *st) /* {{{ */
 
        curl_easy_setopt (st->curl, CURLOPT_URL, st->url);
        curl_easy_setopt (st->curl, CURLOPT_FOLLOWLOCATION, 1L);
+       curl_easy_setopt (st->curl, CURLOPT_MAXREDIRS, 50L);
 
        if (st->verify_peer != 0)
        {
@@ -611,7 +612,7 @@ static int apache_read_host (user_data_t *user_data) /* {{{ */
        assert (st->curl != NULL);
 
        st->apache_buffer_fill = 0;
-       if (curl_easy_perform (st->curl) != 0)
+       if (curl_easy_perform (st->curl) != CURLE_OK)
        {
                ERROR ("apache: curl_easy_perform failed: %s",
                                st->apache_curl_error);
index 3a7c393..94a3938 100644 (file)
@@ -562,6 +562,7 @@ static int ascent_init (void) /* {{{ */
 
   curl_easy_setopt (curl, CURLOPT_URL, url);
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
     curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1L);
@@ -596,7 +597,7 @@ static int ascent_read (void) /* {{{ */
   }
 
   ascent_buffer_fill = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
     ERROR ("ascent plugin: curl_easy_perform failed: %s",
         ascent_curl_error);
index 288949a..ddde840 100644 (file)
@@ -1399,6 +1399,7 @@ static int bind_init (void) /* {{{ */
   curl_easy_setopt (curl, CURLOPT_ERRORBUFFER, bind_curl_error);
   curl_easy_setopt (curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL);
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   return (0);
 } /* }}} int bind_init */
@@ -1414,7 +1415,7 @@ static int bind_read (void) /* {{{ */
   }
 
   bind_buffer_fill = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
     ERROR ("bind plugin: curl_easy_perform failed: %s",
         bind_curl_error);
index 69a5b95..32ba745 100644 (file)
@@ -378,6 +378,7 @@ static int cc_page_init_curl (web_page_t *wp) /* {{{ */
   curl_easy_setopt (wp->curl, CURLOPT_ERRORBUFFER, wp->curl_errbuf);
   curl_easy_setopt (wp->curl, CURLOPT_URL, wp->url);
   curl_easy_setopt (wp->curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (wp->curl, CURLOPT_MAXREDIRS, 50L);
 
   if (wp->user != NULL)
   {
@@ -615,7 +616,7 @@ static int cc_read_page (web_page_t *wp) /* {{{ */
 
   wp->buffer_fill = 0;
   status = curl_easy_perform (wp->curl);
-  if (status != 0)
+  if (status != CURLE_OK)
   {
     ERROR ("curl plugin: curl_easy_perform failed with staus %i: %s",
         status, wp->curl_errbuf);
index 2ddaff3..19efc5d 100644 (file)
@@ -111,16 +111,9 @@ static size_t cj_curl_callback (void *buf, /* {{{ */
   if (db == NULL)
     return (0);
 
-  status = yajl_parse(db->yajl, (unsigned char *) buf, len);
+  status = yajl_parse(db->yajl, (unsigned char *)buf, len);
   if (status == yajl_status_ok)
-  {
-#if HAVE_YAJL_V2
-    status = yajl_complete_parse(db->yajl);
-#else
-    status = yajl_parse_complete(db->yajl);
-#endif
     return (len);
-  }
 #if !HAVE_YAJL_V2
   else if (status == yajl_status_insufficient_data)
     return (len);
@@ -770,7 +763,7 @@ static int cj_curl_perform (cj_t *db, CURL *curl) /* {{{ */
   curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
 
   status = curl_easy_perform (curl);
-  if (status != 0)
+  if (status != CURLE_OK)
   {
     ERROR ("curl_json plugin: curl_easy_perform failed with status %i: %s (%s)",
            status, db->curl_errbuf, (url != NULL) ? url : "<null>");
index da90d7c..75f5cc3 100644 (file)
@@ -365,7 +365,7 @@ static int cx_handle_instance_xpath (xmlXPathContextPtr xpath_ctx, /* {{{ */
     instance_node = instance_node_obj->nodesetval;
     tmp_size = (instance_node) ? instance_node->nodeNr : 0;
 
-    if ( (tmp_size == 0) && (is_table) )
+    if (tmp_size <= 0)
     {
       WARNING ("curl_xml plugin: "
           "relative xpath expression for 'InstanceFrom' \"%s\" doesn't match "
@@ -553,6 +553,12 @@ static int cx_curl_perform (cx_t *db, CURL *curl) /* {{{ */
 
   db->buffer_fill = 0; 
   status = curl_easy_perform (curl);
+  if (status != CURLE_OK)
+  {
+    ERROR ("curl_xml plugin: curl_easy_perform failed with status %i: %s (%s)",
+           status, db->curl_errbuf, url);
+    return (-1);
+  }
 
   curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);
   curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &rc);
@@ -565,13 +571,6 @@ static int cx_curl_perform (cx_t *db, CURL *curl) /* {{{ */
     return (-1);
   }
 
-  if (status != 0)
-  {
-    ERROR ("curl_xml plugin: curl_easy_perform failed with status %i: %s (%s)",
-           status, db->curl_errbuf, url);
-    return (-1);
-  }
-
   ptr = db->buffer;
 
   status = cx_parse_stats_xml(BAD_CAST ptr, db);
index 0e807c7..ee37c60 100644 (file)
@@ -492,7 +492,7 @@ static int fork_child (program_list_t *pl, int *fd_in, int *fd_out, int *fd_err)
       close (fd_pipe_out[1]);
     }
 
-    /* Now connect the `out' pipe to STDOUT */
+    /* Now connect the `err' pipe to STDERR */
     if (fd_pipe_err[1] != STDERR_FILENO)
     {
       dup2 (fd_pipe_err[1], STDERR_FILENO);
index 32b352b..6f2d69a 100644 (file)
@@ -403,6 +403,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con)
        {
                ERROR ("mysql plugin: Failed to get master statistics: "
                                "`%s' did not return any rows.", query);
+               mysql_free_result (res);
                return (-1);
        }
 
@@ -411,6 +412,7 @@ static int mysql_read_master_stats (mysql_database_t *db, MYSQL *con)
        {
                ERROR ("mysql plugin: Failed to get master statistics: "
                                "`%s' returned less than two columns.", query);
+               mysql_free_result (res);
                return (-1);
        }
 
@@ -454,6 +456,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
        {
                ERROR ("mysql plugin: Failed to get slave statistics: "
                                "`%s' did not return any rows.", query);
+               mysql_free_result (res);
                return (-1);
        }
 
@@ -462,6 +465,7 @@ static int mysql_read_slave_stats (mysql_database_t *db, MYSQL *con)
        {
                ERROR ("mysql plugin: Failed to get slave statistics: "
                                "`%s' returned less than 33 columns.", query);
+               mysql_free_result (res);
                return (-1);
        }
 
index b76f25b..7568a2c 100644 (file)
@@ -144,6 +144,7 @@ static int init (void)
   }
 
   curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1L);
+  curl_easy_setopt (curl, CURLOPT_MAXREDIRS, 50L);
 
   if ((verify_peer == NULL) || IS_TRUE (verify_peer))
   {
@@ -214,7 +215,7 @@ static int nginx_read (void)
     return (-1);
 
   nginx_buffer_len = 0;
-  if (curl_easy_perform (curl) != 0)
+  if (curl_easy_perform (curl) != CURLE_OK)
   {
     WARNING ("nginx plugin: curl_easy_perform failed: %s", nginx_curl_error);
     return (-1);
index 6b1c64a..7f5943a 100644 (file)
@@ -88,7 +88,7 @@ static int wh_send_buffer (wh_callback_t *cb) /* {{{ */
 
         curl_easy_setopt (cb->curl, CURLOPT_POSTFIELDS, cb->send_buffer);
         status = curl_easy_perform (cb->curl);
-        if (status != 0)
+        if (status != CURLE_OK)
         {
                 ERROR ("write_http plugin: curl_easy_perform failed with "
                                 "status %i: %s",