If sysconf() fails, the number of CPUs is reported as UINT_MAX, not 1 as it should be

This commit is contained in:
Corey Richardson 2012-09-26 16:28:29 -04:00 committed by Jason Evans
parent 35579afb55
commit 1d553f72cb

View File

@ -254,12 +254,13 @@ malloc_ncpus(void)
result = si.dwNumberOfProcessors; result = si.dwNumberOfProcessors;
#else #else
result = sysconf(_SC_NPROCESSORS_ONLN); result = sysconf(_SC_NPROCESSORS_ONLN);
#endif
if (result == -1) { if (result == -1) {
/* Error. */ /* Error. */
ret = 1; ret = 1;
} } else {
#endif
ret = (unsigned)result; ret = (unsigned)result;
}
return (ret); return (ret);
} }