summaryrefslogtreecommitdiffstats
path: root/contrib/libc++/src/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++/src/thread.cpp')
-rw-r--r--contrib/libc++/src/thread.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/libc++/src/thread.cpp b/contrib/libc++/src/thread.cpp
index 8747adf..b2bd07e 100644
--- a/contrib/libc++/src/thread.cpp
+++ b/contrib/libc++/src/thread.cpp
@@ -67,8 +67,10 @@ thread::hardware_concurrency() _NOEXCEPT
return n;
#elif defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) && defined(_SC_NPROCESSORS_ONLN)
long result = sysconf(_SC_NPROCESSORS_ONLN);
- if (result < 0 || result > UINT_MAX)
- result = 0;
+ // sysconf returns -1 if the name is invalid, the option does not exist or
+ // does not have a definite limit.
+ if (result == -1)
+ return 0;
return result;
#else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar
OpenPOWER on IntegriCloud