If sysconf() fails, the number of CPUs is reported as UINT_MAX, not 1 as it should be
This commit is contained in:
parent
35579afb55
commit
1d553f72cb
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user