diff options
author | Burt P <pburt0@gmail.com> | 2017-12-16 12:58:52 -0600 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-02-22 16:25:17 -0800 |
commit | 2ae6301cc9abcb26e4d98d44c8cf267052d0622a (patch) | |
tree | dc48bae68b3523d0b5f7009c0fd089054f56ecae /hardinfo | |
parent | 6bc582266cda64d5870cca3cc45fb0b95c5ee33a (diff) |
cpu_util: bug fix
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo')
-rw-r--r-- | hardinfo/cpu_util.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/hardinfo/cpu_util.c b/hardinfo/cpu_util.c index f5bddd5c..e5cf9045 100644 --- a/hardinfo/cpu_util.c +++ b/hardinfo/cpu_util.c @@ -85,7 +85,8 @@ int cpu_procs_cores_threads(int *p, int *c, int *t) { for (i = 0; i <= m; i++) { pack_id = get_cpu_int("topology/physical_package_id", i, CPU_TOPO_NULL); core_id = get_cpu_int("topology/core_id", i, CPU_TOPO_NULL); - if (pack_id >= 0) { CPUBIT_SET(packs, pack_id); } + if (pack_id < 0) pack_id = 0; + CPUBIT_SET(packs, pack_id); if (core_id >= 0) { CPUBIT_SET(cores, (pack_id * MAX_CORES_PER_PACK) + core_id ); } } *t = cpubits_count(threads); |