Many build fixes that turned up with GCC 4.6.
[collectd.git] / src / vserver.c
index dac4392..1615ca0 100644 (file)
@@ -1,6 +1,7 @@
 /**
  * collectd - src/vserver.c
  * Copyright (C) 2006,2007  Sebastian Harl
+ * Copyright (C) 2007,2008  Florian octo Forster
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License as published by the
@@ -17,6 +18,7 @@
  *
  * Authors:
  *   Sebastian Harl <sh at tokkee.org>
+ *   Florian octo Forster <octo at verplant.org>
  **/
 
 #include "collectd.h"
@@ -56,7 +58,6 @@ static void traffic_submit (const char *plugin_instance,
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
@@ -78,7 +79,6 @@ static void load_submit (const char *plugin_instance,
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
@@ -98,7 +98,6 @@ static void submit_gauge (const char *plugin_instance, const char *type,
 
        vl.values = values;
        vl.values_len = STATIC_ARRAY_SIZE (values);
-       vl.time = time (NULL);
        sstrncpy (vl.host, hostname_g, sizeof (vl.host));
        sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
        sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
@@ -142,7 +141,7 @@ static int vserver_read (void)
 
        while (42)
        {
-               size_t len;
+               int len;
                char file[BUFSIZE];
 
                FILE *fh;
@@ -171,7 +170,7 @@ static int vserver_read (void)
                if (dent->d_name[0] == '.')
                        continue;
 
-               len = snprintf (file, sizeof (file), PROCDIR "/%s", dent->d_name);
+               len = ssnprintf (file, sizeof (file), PROCDIR "/%s", dent->d_name);
                if ((len < 0) || (len >= BUFSIZE))
                        continue;
                
@@ -190,7 +189,7 @@ static int vserver_read (void)
                /* socket message accounting */
                len = ssnprintf (file, sizeof (file),
                                PROCDIR "/%s/cacct", dent->d_name);
-               if ((len < 0) || (len >= sizeof (file)))
+               if ((len < 0) || ((size_t) len >= sizeof (file)))
                        continue;
 
                if (NULL == (fh = fopen (file, "r")))
@@ -238,7 +237,7 @@ static int vserver_read (void)
                /* thread information and load */
                len = ssnprintf (file, sizeof (file),
                                PROCDIR "/%s/cvirt", dent->d_name);
-               if ((len < 0) || (len >= sizeof (file)))
+               if ((len < 0) || ((size_t) len >= sizeof (file)))
                        continue;
 
                if (NULL == (fh = fopen (file, "r")))
@@ -291,7 +290,7 @@ static int vserver_read (void)
                /* processes and memory usage */
                len = ssnprintf (file, sizeof (file),
                                PROCDIR "/%s/limit", dent->d_name);
-               if ((len < 0) || (len >= sizeof (file)))
+               if ((len < 0) || ((size_t) len >= sizeof (file)))
                        continue;
 
                if (NULL == (fh = fopen (file, "r")))