netapp plugin: Fix a typo.
[collectd.git] / src / nginx.c
index ea5c126..53137a7 100644 (file)
@@ -54,7 +54,8 @@ static const char *config_keys[] =
 };
 static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
 
-static size_t nginx_curl_callback (void *buf, size_t size, size_t nmemb, void *stream)
+static size_t nginx_curl_callback (void *buf, size_t size, size_t nmemb,
+    void __attribute__((unused)) *stream)
 {
   size_t len = size * nmemb;
 
@@ -124,8 +125,9 @@ static int init (void)
 
   if (user != NULL)
   {
-    if (ssnprintf (credentials, sizeof (credentials),
-         "%s:%s", user, pass == NULL ? "" : pass) >= sizeof (credentials))
+    int status = ssnprintf (credentials, sizeof (credentials),
+       "%s:%s", user, pass == NULL ? "" : pass);
+    if ((status < 0) || ((size_t) status >= sizeof (credentials)))
     {
       ERROR ("nginx plugin: Credentials would have been truncated.");
       return (-1);
@@ -139,6 +141,8 @@ static int init (void)
     curl_easy_setopt (curl, CURLOPT_URL, url);
   }
 
+  curl_easy_setopt (curl, CURLOPT_FOLLOWLOCATION, 1);
+
   if ((verify_peer == NULL) || (strcmp (verify_peer, "true") == 0))
   {
     curl_easy_setopt (curl, CURLOPT_SSL_VERIFYPEER, 1);
@@ -179,7 +183,6 @@ static void submit (char *type, char *inst, long long value)
 
   vl.values = values;
   vl.values_len = 1;
-  vl.time = time (NULL);
   sstrncpy (vl.host, hostname_g, sizeof (vl.host));
   sstrncpy (vl.plugin, "nginx", sizeof (vl.plugin));
   sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance));