diff options
author | Karel Zak | 2019-05-20 12:35:38 +0200 |
---|---|---|
committer | Karel Zak | 2019-05-20 12:35:38 +0200 |
commit | 002931c485dd66c23b63750a7d9d09637e9bc1ef (patch) | |
tree | f4209fc28f52b9aa6159af0afb43b43f07b4326f /sys-utils | |
parent | Merge branch 'lscpu_midr_updates' of https://github.com/jlinton/util-linux (diff) | |
parent | lib/colors: remove redundant if statement (diff) | |
download | kernel-qcow2-util-linux-002931c485dd66c23b63750a7d9d09637e9bc1ef.tar.gz kernel-qcow2-util-linux-002931c485dd66c23b63750a7d9d09637e9bc1ef.tar.xz kernel-qcow2-util-linux-002931c485dd66c23b63750a7d9d09637e9bc1ef.zip |
Merge branch '2019wk19' of https://github.com/kerolasa/util-linux
* '2019wk19' of https://github.com/kerolasa/util-linux:
lib/colors: remove redundant if statement
wipefs: fix variable / function shadowing [cppcheck]
sulogin: fix variable / function shadowing [cppcheck]
lscpu: remove redundant condition check [cppcheck]
libmount: avoid possible null pointer dereference [cppcheck]
lib/mangle: fix possible null pointer dereference [cppcheck]
sfdisk: remove unnecessary size check [cppcheck]
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/lscpu.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c index 7f6277f00..f64d81836 100644 --- a/sys-utils/lscpu.c +++ b/sys-utils/lscpu.c @@ -1778,10 +1778,12 @@ print_cpus_parsable(struct lscpu_desc *desc, int cols[], int ncols, int c; int cpu = real_cpu_num(desc, i); - if (!mod->offline && desc->online && !is_cpu_online(desc, cpu)) - continue; - if (!mod->online && desc->online && is_cpu_online(desc, cpu)) - continue; + if (desc->online) { + if (!mod->offline && !is_cpu_online(desc, cpu)) + continue; + if (!mod->online && is_cpu_online(desc, cpu)) + continue; + } if (desc->present && !is_cpu_present(desc, cpu)) continue; for (c = 0; c < ncols; c++) { @@ -1835,10 +1837,12 @@ print_cpus_readable(struct lscpu_desc *desc, int cols[], int ncols, struct libscols_line *line; int cpu = real_cpu_num(desc, i); - if (!mod->offline && desc->online && !is_cpu_online(desc, cpu)) - continue; - if (!mod->online && desc->online && is_cpu_online(desc, cpu)) - continue; + if (desc->online) { + if (!mod->offline && !is_cpu_online(desc, cpu)) + continue; + if (!mod->online && is_cpu_online(desc, cpu)) + continue; + } if (desc->present && !is_cpu_present(desc, cpu)) continue; |