X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbind.c;h=b77a6418b9f94dfde0acbe4decf78c21aca45e52;hb=0b7cd83a5e6bac068ea83a88a5ddcfb07c09fbec;hp=dc7916a874e1c990d47cb8cb87c716e13235da7e;hpb=be126043c2be20399d7670fe194645292018bde0;p=collectd.git diff --git a/src/bind.c b/src/bind.c index dc7916a8..b77a6418 100644 --- a/src/bind.c +++ b/src/bind.c @@ -440,18 +440,14 @@ static int bind_xml_read_timestamp(const char *xpath_expression, /* {{{ */ #if HAVE_TIMEGM time_t t = timegm(&tm); if (t == ((time_t)-1)) { - char errbuf[1024]; - ERROR("bind plugin: timegm() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("bind plugin: timegm() failed: %s", STRERRNO); return -1; } *ret_value = t; #else time_t t = mktime(&tm); if (t == ((time_t)-1)) { - char errbuf[1024]; - ERROR("bind plugin: mktime() failed: %s", - sstrerror(errno, errbuf, sizeof(errbuf))); + ERROR("bind plugin: mktime() failed: %s", STRERRNO); return -1; } /* mktime assumes that tm is local time. Luckily, it also sets timezone to @@ -737,8 +733,8 @@ static int bind_xml_stats_handle_zone(int version, xmlDoc *doc, /* {{{ */ nsstats_translation_table_length, plugin_instance}; - snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s", - view->name, zone_name); + snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s", view->name, + zone_name); if (version == 3) { list_info_ptr_t list_info = {plugin_instance, @@ -868,8 +864,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */ list_info_ptr_t list_info = {plugin_instance, /* type = */ "dns_qtype"}; - snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes", - view->name); + snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes", view->name); if (version == 3) { bind_parse_generic_name_attr_value_list( /* xpath = */ "counters[@type='resqtype']", @@ -892,7 +887,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */ plugin_instance}; snprintf(plugin_instance, sizeof(plugin_instance), "%s-resolver_stats", - view->name); + view->name); if (version == 3) { bind_parse_generic_name_attr_value_list( "counters[@type='resstats']", @@ -915,7 +910,7 @@ static int bind_xml_stats_handle_view(int version, xmlDoc *doc, /* {{{ */ /* type = */ "dns_qtype_cached"}; snprintf(plugin_instance, sizeof(plugin_instance), "%s-cache_rr_sets", - view->name); + view->name); bind_parse_generic_name_value(/* xpath = */ "cache/rrset", /* callback = */ bind_xml_list_callback, @@ -1598,7 +1593,6 @@ static int bind_init(void) /* {{{ */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, bind_curl_callback); curl_easy_setopt(curl, CURLOPT_USERAGENT, COLLECTD_USERAGENT); 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); #ifdef HAVE_CURLOPT_TIMEOUT_MS @@ -1620,6 +1614,9 @@ static int bind_read(void) /* {{{ */ } bind_buffer_fill = 0; + + curl_easy_setopt(curl, CURLOPT_URL, (url != NULL) ? url : BIND_DEFAULT_URL); + if (curl_easy_perform(curl) != CURLE_OK) { ERROR("bind plugin: curl_easy_perform failed: %s", bind_curl_error); return -1;