diff options
author | Corey Richardson <corey@octayn.net> | 2012-09-26 20:28:29 (GMT) |
---|---|---|
committer | Jason Evans <jasone@canonware.com> | 2012-10-08 22:45:38 (GMT) |
commit | 1d553f72cbbcbacc1802d2cc96a4024315e616b3 (patch) | |
tree | 94a724dd12fdd9c93a0e6003ab6f0e2f8b6e4098 /src/jemalloc.c | |
parent | 35579afb55c0a53261743b3e292f60e76046ff16 (diff) | |
download | jemalloc-1d553f72cbbcbacc1802d2cc96a4024315e616b3.zip jemalloc-1d553f72cbbcbacc1802d2cc96a4024315e616b3.tar.gz jemalloc-1d553f72cbbcbacc1802d2cc96a4024315e616b3.tar.bz2 |
If sysconf() fails, the number of CPUs is reported as UINT_MAX, not 1 as it should be
Diffstat (limited to 'src/jemalloc.c')
-rw-r--r-- | src/jemalloc.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/jemalloc.c b/src/jemalloc.c index 1ab8a1c..7fa0744 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); } |