@cryptotaxi247 / netdata-1 / commits / 6f7f4a331

properly check number of processes monitored by apps.plugin

Costa Tsaousis (ktsaou) committed Dec 30, 2016 at 03:15 UTC 6f7f4a3312381a0bafdd8b7937a3c030c654926d
1 file changed +3 -7
src/apps_plugin.c
+3 -7
@@ -1721,23 +1721,19 @@ static int collect_data_for_all_processes_from_proc(void) {
1721
1722 struct dirent *file = NULL;
1723
1724 - size_t found = 0;
1724 while((file = readdir(dir))) {
1725 char *endptr = file->d_name;
1726 pid_t pid = (pid_t) strtoul(file->d_name, &endptr, 10);
1727
1728 // make sure we read a valid number
1730 - if(unlikely(endptr == file->d_name || *endptr != '\0')) {
1731 - found++;
1729 + if(unlikely(endptr == file->d_name || *endptr != '\0'))
1730 continue;
1733 - }
1731
1735 - if(collect_data_for_pid(pid))
1736 - found++;
1732 + collect_data_for_pid(pid);
1733 }
1734 closedir(dir);
1735
1740 - if(!found)
1736 + if(!all_pids_count)
1737 return 0;
1738
1739 // normally this is done