[collectd] small bugfix for traffic

Peter Holik peter at holik.at
Thu Apr 27 15:09:37 CEST 2006


Hi!

For interfacename longer than 6 chars traffic fails.

This patch should fix this.

cu Peter

--- traffic.c.orig      2006-04-21 17:18:09.000000000 +0200
+++ traffic.c   2006-04-27 14:16:00.000000000 +0200
@@ -195,18 +195,17 @@

        while (fgets (buffer, 1024, fh) != NULL)
        {
-               if (buffer[6] != ':')
+               if (!(dummy = strchr(buffer, ':')))
                        continue;
-               buffer[6] = '\0';
+               *dummy++ = '\0';

                device = buffer;
-               while (device[0] == ' ')
+               while (*device == ' ')
                        device++;

-               if (device[0] == '\0')
+               if (*device == '\0')
                        continue;

-               dummy = buffer + 7;
                numfields = strsplit (dummy, fields, 16);

                if (numfields < 9)





More information about the collectd mailing list