X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbind.c;h=b77a6418b9f94dfde0acbe4decf78c21aca45e52;hb=0b7cd83a5e6bac068ea83a88a5ddcfb07c09fbec;hp=49fb4d7fe0d7fba1cd442cda411b585ca9dbbc0c;hpb=e746ad785774de37a30302fef65f1c4aaf8698ab;p=collectd.git diff --git a/src/bind.c b/src/bind.c index 49fb4d7f..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 @@ -1597,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 @@ -1619,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;