]> arthur.barton.de Git - netdata.git/commitdiff
properly check number of processes monitored by apps.plugin
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 30 Dec 2016 01:15:21 +0000 (03:15 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Fri, 30 Dec 2016 01:15:21 +0000 (03:15 +0200)
src/apps_plugin.c

index 9be4b425fd254ed12889f720fcdd2bd006330a73..51cedaff8589f51dd668d7b8c819c5e36c34daff 100644 (file)
@@ -1721,23 +1721,19 @@ static int collect_data_for_all_processes_from_proc(void) {
 
     struct dirent *file = NULL;
 
-    size_t found = 0;
     while((file = readdir(dir))) {
         char *endptr = file->d_name;
         pid_t pid = (pid_t) strtoul(file->d_name, &endptr, 10);
 
         // make sure we read a valid number
-        if(unlikely(endptr == file->d_name || *endptr != '\0')) {
-            found++;
+        if(unlikely(endptr == file->d_name || *endptr != '\0'))
             continue;
-        }
 
-        if(collect_data_for_pid(pid))
-            found++;
+        collect_data_for_pid(pid);
     }
     closedir(dir);
 
-    if(!found)
+    if(!all_pids_count)
         return 0;
 
     // normally this is done