]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
chcpu: use appropriate variable type [cppcheck]
authorSami Kerola <kerolasa@iki.fi>
Tue, 7 Feb 2012 21:55:56 +0000 (22:55 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 8 Feb 2012 13:17:29 +0000 (14:17 +0100)
[sys-utils/chcpu.c:251]: (style) Checking if unsigned variable 'maxcpus' is less than zero.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/chcpu.c

index 29b7ab8965f8f90abceac74e75359b2776a2ff64..79f51675508f3c71d9c1cfde6c1d4a821054bbef 100644 (file)
@@ -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);