X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbind.c;h=6e13a8be8964d83fa475af35ff9d03ecbbb253ed;hb=e35f3c5c634216860f14586a7d17232022d8b588;hp=783d2b057bfad46aed9ee7dbd0b82b362e4e4117;hpb=d37ebe6eb6dd2bbf8213a924dfbce6e91945aab8;p=collectd.git diff --git a/src/bind.c b/src/bind.c index 783d2b05..6e13a8be 100644 --- a/src/bind.c +++ b/src/bind.c @@ -21,24 +21,10 @@ * Florian Forster **/ -/* Set to C99 and POSIX code */ -#ifndef _ISOC99_SOURCE -# define _ISOC99_SOURCE -#endif -#ifndef _POSIX_SOURCE -# define _POSIX_SOURCE -#endif -#ifndef _POSIX_C_SOURCE -# define _POSIX_C_SOURCE 200112L -#endif -#ifndef _REENTRANT -# define _REENTRANT -#endif +#include "config.h" + #ifndef _XOPEN_SOURCE -# define _XOPEN_SOURCE 600 -#endif -#ifndef _BSD_SOURCE -# define _BSD_SOURCE +# define _XOPEN_SOURCE 600 /* glibc2 needs this for strptime */ #endif #include "collectd.h" @@ -46,6 +32,12 @@ #include "plugin.h" #include "configfile.h" +/* Some versions of libcurl don't include this themselves and then don't have + * fd_set available. */ +#if HAVE_SYS_SELECT_H +# include +#endif + #include #include #include @@ -465,7 +457,7 @@ static int bind_xml_read_timestamp (const char *xpath_expression, /* {{{ */ return (-1); } - *ret_value = timegm(&tm); + *ret_value = mktime(&tm); xmlXPathFreeObject (xpathObj); return (0); @@ -1390,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 */