From bd1de560a1403a3e549938ae244f2f04f7e0b990 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Mon, 19 Sep 2016 09:23:59 -0500 Subject: [PATCH] eina_cpu: Fix error handling in eina_cpu_fast_core_get I introduced a crash on linux systems where the cpufreq directory doesn't exist. This fixes it. --- src/lib/eina/eina_cpu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/eina/eina_cpu.c b/src/lib/eina/eina_cpu.c index 1de86d8..b5e6b90 100644 --- a/src/lib/eina/eina_cpu.c +++ b/src/lib/eina/eina_cpu.c @@ -396,6 +396,9 @@ _eina_cpu_fast_core_get(void) if (fastest_core_speed == 0) eina_cpu_map_init(); + /* Check again now that it's actually set up */ + if (fastest_core_speed == -1) return -1; + corelist = eina_hash_find(cpu_hash, &fastest_core_speed); cores = *corelist; bit = rand() % __builtin_popcount(cores); -- 2.7.4