diff options
author | Sami Kerola | 2012-02-07 22:55:56 +0100 |
---|---|---|
committer | Karel Zak | 2012-02-08 14:17:29 +0100 |
commit | 4b11df2cf50fc324bdc4cb507d773520fb33a896 (patch) | |
tree | 2237ceed55249e68d7a7309408e1c91039a4690a /sys-utils/chcpu.c | |
parent | taskset: use appropriate variable type [cppcheck] (diff) | |
download | kernel-qcow2-util-linux-4b11df2cf50fc324bdc4cb507d773520fb33a896.tar.gz kernel-qcow2-util-linux-4b11df2cf50fc324bdc4cb507d773520fb33a896.tar.xz kernel-qcow2-util-linux-4b11df2cf50fc324bdc4cb507d773520fb33a896.zip |
chcpu: use appropriate variable type [cppcheck]
[sys-utils/chcpu.c:251]: (style) Checking if unsigned variable 'maxcpus' is less than zero.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/chcpu.c')
-rw-r--r-- | sys-utils/chcpu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sys-utils/chcpu.c b/sys-utils/chcpu.c index 29b7ab896..79f516755 100644 --- a/sys-utils/chcpu.c +++ b/sys-utils/chcpu.c @@ -47,7 +47,7 @@ #define _PATH_SYS_CPU_DISPATCH _PATH_SYS_CPU "/dispatching" static cpu_set_t *onlinecpus; -static size_t maxcpus; +static int maxcpus; #define is_cpu_online(cpu) (CPU_ISSET_S((cpu), CPU_ALLOC_SIZE(maxcpus), onlinecpus)) #define num_online_cpus() (CPU_COUNT_S(CPU_ALLOC_SIZE(maxcpus), onlinecpus)) @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) textdomain(PACKAGE); maxcpus = get_max_number_of_cpus(); - if ((int) maxcpus <= 0) + if (maxcpus < 1) errx(EXIT_FAILURE, _("cannot determine NR_CPUS; aborting")); if (path_exist(_PATH_SYS_CPU_ONLINE)) onlinecpus = path_cpulist(maxcpus, _PATH_SYS_CPU_ONLINE); |