1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-09-29 13:39:10 +00:00

Increase info.cpu_count for single-core systems (#257)

On single-core systems, sscanf() does't match, as the sysfs file contains the value 0 instead of i.e. 0-7 for multi-core systems.
This commit is contained in:
icanhasserver 2016-05-14 19:41:35 +02:00 committed by Brenden Matthews
parent dbf26f0a42
commit e056dca8f1

View File

@ -820,9 +820,10 @@ void get_cpu_count(void)
}
if (sscanf(buf, "%*d-%d", &highest_cpu_index) == 1) {
info.cpu_count = highest_cpu_index + 1;
info.cpu_count = highest_cpu_index;
}
}
++info.cpu_count;
info.cpu_usage = (float*)malloc((info.cpu_count + 1) * sizeof(float));
fclose(stat_fp);