X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_xml.c;h=75f5cc33d946e74cfb3d77f006d4babfaadb6513;hb=f522f2111990f89c09507aa867ad63bbc44d9b7a;hp=46e0d490967456156863413912fe234deeb5abda;hpb=5347744b510e0a94639905e0263689bf46d90de2;p=collectd.git diff --git a/src/curl_xml.c b/src/curl_xml.c index 46e0d490..75f5cc33 100644 --- a/src/curl_xml.c +++ b/src/curl_xml.c @@ -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); @@ -737,7 +736,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_NOSIGNAL, 1L); 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,