X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbind.c;h=6e13a8be8964d83fa475af35ff9d03ecbbb253ed;hb=e35f3c5c634216860f14586a7d17232022d8b588;hp=44efcfd55ba58982d6fdb2244a54ecac3b4e19b1;hpb=37905c5a2370c8e6edae5011978773eeaa589d09;p=collectd.git diff --git a/src/bind.c b/src/bind.c index 44efcfd5..6e13a8be 100644 --- a/src/bind.c +++ b/src/bind.c @@ -21,7 +21,11 @@ * Florian Forster **/ -#define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */ +#include "config.h" + +#ifndef _XOPEN_SOURCE +# define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */ +#endif #include "collectd.h" #include "common.h" @@ -227,19 +231,6 @@ static int memsummary_translation_table_length = STATIC_ARRAY_SIZE (memsummary_translation_table); /* }}} */ -static void remove_special (char *buffer, size_t buffer_size) /* {{{ */ -{ - size_t i; - - for (i = 0; i < buffer_size; i++) - { - if (buffer[i] == 0) - return; - if ((!isalnum ((int) buffer[i])) && (buffer[i] != '-')) - buffer[i] = '_'; - } -} /* }}} void remove_special */ - static void submit (time_t ts, const char *plugin_instance, /* {{{ */ const char *type, const char *type_instance, value_t value) { @@ -256,13 +247,13 @@ static void submit (time_t ts, const char *plugin_instance, /* {{{ */ if (plugin_instance) { sstrncpy(vl.plugin_instance, plugin_instance, sizeof(vl.plugin_instance)); - remove_special (vl.plugin_instance, sizeof (vl.plugin_instance)); + replace_special (vl.plugin_instance, sizeof (vl.plugin_instance)); } sstrncpy(vl.type, type, sizeof(vl.type)); if (type_instance) { sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance)); - remove_special (vl.plugin_instance, sizeof (vl.plugin_instance)); + replace_special (vl.plugin_instance, sizeof (vl.plugin_instance)); } plugin_dispatch_values(&vl); } /* }}} void submit */ @@ -1391,10 +1382,12 @@ static int bind_init (void) /* {{{ */ return (-1); } + curl_easy_setopt (curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt (curl, CURLOPT_WRITEFUNCTION, bind_curl_callback); curl_easy_setopt (curl, CURLOPT_USERAGENT, PACKAGE_NAME"/"PACKAGE_VERSION); 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, 1); return (0); } /* }}} int bind_init */