Misc fixes, thanks to octo for pointing them out
[collectd.git] / src / processes.c
index e37e566..7bbd3f6 100644 (file)
@@ -759,15 +759,16 @@ static procstat_t *ps_read_vmem (int pid, procstat_t *ps)
        if ((fh = fopen (filename, "r")) == NULL)
                return (NULL);
 
-       while (fgets (buffer, 1024, fh) != NULL)
+       while (fgets (buffer, sizeof(buffer), fh) != NULL)
        {
                long long tmp;
                char *endptr;
 
-               if (strncasecmp (buffer, "Vm", 2) != 0)
+               if (strncmp (buffer, "Vm", 2) != 0)
                        continue;
 
-               numfields = strsplit (buffer, fields, 8);
+               numfields = strsplit (buffer, fields,
+                                      STATIC_ARRAY_SIZE (fields));
 
                if (numfields < 2)
                        continue;
@@ -1302,6 +1303,7 @@ static int ps_read (void)
                                }
 
                                pse.num_proc++;
+                               pse.vmem_size = task_basic_info.virtual_size;
                                pse.vmem_rss = task_basic_info.resident_size;
                                /* Does not seem to be easily exposed */
                                pse.vmem_data = 0;