skip spaces when reading cpuset (#16385)
skip space in cpuset
Ilya Mashchenko committed
Nov 11, 2023 at 16:50 UTC
75c56972354bfd894596c6d1ef5637fb9b33d544
1 file changed
+5
-1
libnetdata/os.c
+5
-1
@@ -162,7 +162,11 @@ unsigned long read_cpuset_cpus(const char *filename, long system_cpus) {
162
unsigned long ncpus = 0;
163
164
// parse the cpuset string and calculate the number of cpus the cgroup is allowed to use
165
- while(*s) {
165
+ while (*s) {
166
+ if (isspace(*s)) {
167
+ s++;
168
+ continue;
169
+ }
170
unsigned long n = cpuset_str2ul(&s);
171
ncpus++;
172
if(*s == ',') {