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;
#else
result = sysconf(_SC_NPROCESSORS_ONLN);
#endif
if (result == -1) {
/* Error. */
ret = 1;
}
#endif
ret = (unsigned)result;
} else {
ret = (unsigned)result;
}
return (ret);
}