summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2023-11-11 16:50:19 +0200
committerGitHub <noreply@github.com>2023-11-11 16:50:19 +0200
commit75c56972354bfd894596c6d1ef5637fb9b33d544 (patch)
tree3cf5d20e0d985dc1994262fec68cd3c8246d503a
parent487e2b99676293b3e9d879d76bcefcd25bfc3ff7 (diff)
skip spaces when reading cpuset (#16385)
skip space in cpuset
-rw-r--r--libnetdata/os.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libnetdata/os.c b/libnetdata/os.c
index e6475a453f..e4624be69f 100644
--- a/libnetdata/os.c
+++ b/libnetdata/os.c
@@ -162,7 +162,11 @@ unsigned long read_cpuset_cpus(const char *filename, long system_cpus) {
unsigned long ncpus = 0;
// parse the cpuset string and calculate the number of cpus the cgroup is allowed to use
- while(*s) {
+ while (*s) {
+ if (isspace(*s)) {
+ s++;
+ continue;
+ }
unsigned long n = cpuset_str2ul(&s);
ncpus++;
if(*s == ',') {