diff options
author | Angelo Marletta <angelo.marletta@gmail.com> | 2015-02-17 01:04:25 -0800 |
---|---|---|
committer | Angelo Marletta <angelo.marletta@gmail.com> | 2015-02-17 01:04:25 -0800 |
commit | fd48ecf5a123ddaf5dd02d7928f975db719975bb (patch) | |
tree | 7164753f2c3889cf29a21fab166a052f073a38de /src/cpulimit.c | |
parent | fbed9dd0ba1e849ebc07f512903996879096df2d (diff) | |
parent | 37f61593b40aa98b465692d9a40c6ac03264a29a (diff) | |
download | cpulimit-fd48ecf5a123ddaf5dd02d7928f975db719975bb.tar.gz |
Merge pull request #43 from opsengine/cppcheck
fix cppcheck warnings
Diffstat (limited to 'src/cpulimit.c')
-rw-r--r-- | src/cpulimit.c | 4 |
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; } |