From f1a3542734cda5f914c15550c55812c5d26cb1b5 Mon Sep 17 00:00:00 2001 From: rtoijala Date: Fri, 10 Jul 2015 12:22:18 +0300 Subject: [PATCH] call get_cpu_count() when needed get_cpu_count() is not called before trying to use cpus so conky exits with conky: obj->data.i 1 info.cpu_count 0 conky: attempting to use more CPUs than you have! Fixes issue #93. --- src/core.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/core.cc b/src/core.cc index e39eefd9..56eb8207 100644 --- a/src/core.cc +++ b/src/core.cc @@ -571,23 +571,27 @@ struct text_object *construct_text_object(char *s, const char *arg, __var = 0; \ } END OBJ(cpu, &update_cpu_usage) + get_cpu_count(); SCAN_CPU(arg, obj->data.i); obj->callbacks.percentage = &cpu_percentage; DBGP2("Adding $cpu for CPU %d", obj->data.i); #ifdef BUILD_X11 END OBJ(cpugauge, &update_cpu_usage) + get_cpu_count(); SCAN_CPU(arg, obj->data.i); scan_gauge(obj, arg, 1); obj->callbacks.gaugeval = &cpu_barval; DBGP2("Adding $cpugauge for CPU %d", obj->data.i); #endif END OBJ(cpubar, &update_cpu_usage) + get_cpu_count(); SCAN_CPU(arg, obj->data.i); scan_bar(obj, arg, 1); obj->callbacks.barval = &cpu_barval; DBGP2("Adding $cpubar for CPU %d", obj->data.i); #ifdef BUILD_X11 END OBJ(cpugraph, &update_cpu_usage) + get_cpu_count(); char *buf = 0; SCAN_CPU(arg, obj->data.i); buf = scan_graph(obj, arg, 1);