aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-06-22 13:50:34 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-06-22 13:50:34 -0700
commit5912fb5ca084dd044217af5ea915c84104fff212 (patch)
tree79c8a7907d3eae2c2a4e638e4726f6affd28e399 /src/core
parent04a0395670322d5a7c08aafdf54b7a44ce9e78e3 (diff)
Reverted incorrect type change
Diffstat (limited to 'src/core')
-rw-r--r--src/core/support/cpu_linux.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/support/cpu_linux.c b/src/core/support/cpu_linux.c
index a748d43cf0..b59d013e92 100644
--- a/src/core/support/cpu_linux.c
+++ b/src/core/support/cpu_linux.c
@@ -48,10 +48,11 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
-static unsigned ncpus = 0;
+static int ncpus = 0;
static void init_num_cpus() {
- ncpus = (unsigned)sysconf(_SC_NPROCESSORS_ONLN);
+ // This must be signed. sysconf returns -1 when the number can't be determined
+ ncpus = (int)sysconf(_SC_NPROCESSORS_ONLN);
if (ncpus < 1) {
gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1");
ncpus = 1;
@@ -61,7 +62,7 @@ static void init_num_cpus() {
unsigned gpr_cpu_num_cores(void) {
static gpr_once once = GPR_ONCE_INIT;
gpr_once_init(&once, init_num_cpus);
- return ncpus;
+ return (unsigned)ncpus;
}
unsigned gpr_cpu_current_cpu(void) {