X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fapache.c;h=0db532866ead5f8fef34ebebe12db6e2058ecf2a;hb=fdf8a2725fab0a1b6cfa26f453fcb306dd1ab05e;hp=c515e3c5db57a45bc04e706db387d02b5a27ba24;hpb=6a68a39a2c6987fdcc94fb1bdd9cc8f598fd9478;p=collectd.git diff --git a/src/apache.c b/src/apache.c index c515e3c5..0db53286 100644 --- a/src/apache.c +++ b/src/apache.c @@ -98,7 +98,7 @@ static size_t apache_curl_callback (void *buf, size_t size, size_t nmemb, return (0); } - if (len <= 0) + if (len == 0) return (len); if ((st->apache_buffer_fill + len) >= st->apache_buffer_size) @@ -137,7 +137,7 @@ static size_t apache_header_callback (void *buf, size_t size, size_t nmemb, return (0); } - if (len <= 0) + if (len == 0) return (len); /* look for the Server header */ @@ -175,13 +175,12 @@ static int config_add (oconfig_item_t *ci) int i; int status; - st = malloc (sizeof (*st)); + st = calloc (1, sizeof (*st)); if (st == NULL) { - ERROR ("apache plugin: malloc failed."); + ERROR ("apache plugin: calloc failed."); return (-1); } - memset (st, 0, sizeof (*st)); st->timeout = -1; @@ -255,7 +254,7 @@ static int config_add (oconfig_item_t *ci) status = plugin_register_complex_read (/* group = */ NULL, /* name = */ callback_name, /* callback = */ apache_read_host, - /* interval = */ NULL, + /* interval = */ 0, /* user_data = */ &ud); } @@ -383,8 +382,7 @@ static int init_host (apache_t *st) /* {{{ */ if (st->timeout >= 0) curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) st->timeout); else - curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, - CDTIME_T_TO_MS(plugin_get_interval())); + curl_easy_setopt (st->curl, CURLOPT_TIMEOUT_MS, (long) CDTIME_T_TO_MS(plugin_get_interval())); #endif return (0);