From 1d553f72cbbcbacc1802d2cc96a4024315e616b3 Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Wed, 26 Sep 2012 16:28:29 -0400 Subject: [PATCH] If sysconf() fails, the number of CPUs is reported as UINT_MAX, not 1 as it should be --- src/jemalloc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/jemalloc.c b/src/jemalloc.c index 1ab8a1cf..7fa07449 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -254,12 +254,13 @@ malloc_ncpus(void) result = si.dwNumberOfProcessors; #else result = sysconf(_SC_NPROCESSORS_ONLN); +#endif if (result == -1) { /* Error. */ ret = 1; - } -#endif - ret = (unsigned)result; + } else { + ret = (unsigned)result; + } return (ret); }