aboutsummaryrefslogtreecommitdiffstats
path: root/src/cpulimit.c
diff options
context:
space:
mode:
authorAngelo Marletta <angelops@fb.com>2014-09-27 15:54:57 -0700
committerAngelo Marletta <angelops@fb.com>2014-12-24 03:46:29 +0100
commit37f61593b40aa98b465692d9a40c6ac03264a29a (patch)
tree7164753f2c3889cf29a21fab166a052f073a38de /src/cpulimit.c
parentfbed9dd0ba1e849ebc07f512903996879096df2d (diff)
downloadcpulimit-37f61593b40aa98b465692d9a40c6ac03264a29a.tar.gz
fix cppcheck warnings
Diffstat (limited to 'src/cpulimit.c')
-rw-r--r--src/cpulimit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/cpulimit.c b/src/cpulimit.c
index 9b25b87..dc61c3b 100644
--- a/src/cpulimit.c
+++ b/src/cpulimit.c
@@ -147,7 +147,7 @@ static void increase_priority() {
/* Get the number of CPUs */
static int get_ncpu() {
- int ncpu = -1;
+ int ncpu;
#ifdef _SC_NPROCESSORS_ONLN
ncpu = sysconf(_SC_NPROCESSORS_ONLN);
#elif defined __APPLE__
@@ -156,6 +156,8 @@ static int get_ncpu() {
sysctl(mib, 2, &ncpu, &len, NULL, 0);
#elif defined _GNU_SOURCE
ncpu = get_nprocs();
+#else
+ ncpu = -1;
#endif
return ncpu;
}
Un proyecto texto-plano.xyz