summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2020-01-20 19:33:00 +0000
committerMichael Meeks <michael.meeks@collabora.com>2020-02-14 23:33:38 +0100
commit7091f57b358fd06a236b96cc91990251bba8ea6e (patch)
tree54d881da95b4b9dbaf607b9b3cba50eddb5bda1c
parentFix an UB in the DocumentBroker dtor (diff)
downloadonline-7091f57b358fd06a236b96cc91990251bba8ea6e.tar.gz
online-7091f57b358fd06a236b96cc91990251bba8ea6e.zip
util: for process thread count - ignore '.' and '..' in /proc/self/tasks
Change-Id: Ieec6eaac475b4e318578cfc0d93c36e2395e6f19 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87097 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> (cherry picked from commit 09bb16ad78f71e285b6059774ce089b9ef1d006b) Reviewed-on: https://gerrit.libreoffice.org/c/online/+/87110
-rw-r--r--common/Util.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/common/Util.cpp b/common/Util.cpp
index 2a01516151..253c4a35e7 100644
--- a/common/Util.cpp
+++ b/common/Util.cpp
@@ -157,8 +157,12 @@ namespace Util
return -1;
}
int tasks = 0;
- while (readdir(fdDir))
- tasks++;
+ struct dirent *i;
+ while ((i = readdir(fdDir)))
+ {
+ if (i->d_name[0] != '.')
+ tasks++;
+ }
closedir(fdDir);
return tasks;
}