Merge remote-tracking branch 'github/pr/413' into collectd-5.4
authorFlorian Forster <octo@collectd.org>
Wed, 28 Aug 2013 13:22:37 +0000 (15:22 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 28 Aug 2013 13:22:37 +0000 (15:22 +0200)
1  2 
src/cgroups.c

diff --combined src/cgroups.c
@@@ -93,7 -93,7 +93,7 @@@ static int read_cpuacct_procs (const ch
        if (fh == NULL)
        {
                char errbuf[1024];
-               ERROR ("cgroups pluign: fopen (\"%s\") failed: %s",
+               ERROR ("cgroups plugin: fopen (\"%s\") failed: %s",
                                abs_path,
                                sstrerror (errno, errbuf, sizeof (errbuf)));
                return (-1);
                 *
                 *   user: 12345
                 *   system: 23456
+                *
+                * Or:
+                *
+                *   user 12345
+                *   system 23456
                 */
                strstripnewline (buf);
                numfields = strsplit (buf, fields, STATIC_ARRAY_SIZE (fields));
                if (key_len < 2)
                        continue;
  
-               /* Strip colon off the first column */
-               if (key[key_len - 1] != ':')
-                       continue;
-               key[key_len - 1] = 0;
+               /* Strip colon off the first column, if found */
+               if (key[key_len - 1] == ':')
+                       key[key_len - 1] = 0;
  
                status = parse_value (fields[1], &value, DS_TYPE_DERIVE);
                if (status != 0)
@@@ -217,9 -221,8 +221,9 @@@ static int cgroups_read (void
        {
                /* Find the cgroup mountpoint which contains the cpuacct
                 * controller. */
 -              if (strcmp(mnt_ptr->type, "cgroup") != 0 ||
 -                      !cu_mount_getoptionvalue(mnt_ptr->options, "cpuacct"))
 +              if ((strcmp(mnt_ptr->type, "cgroup") != 0)
 +                              || !cu_mount_checkoption(mnt_ptr->options,
 +                                      "cpuacct", /* full = */ 1))
                        continue;
  
                walk_directory (mnt_ptr->dir, read_cpuacct_root,