Saleem Abdulrasool:  cleanup a few more compile warnings emitted by GCC.

llvm-svn: 171173
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 6b0101acae4828663cb466e8b2be40d2317bc2ed
diff --git a/src/thread.cpp b/src/thread.cpp
index 8747adf..b2bd07e 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -67,8 +67,10 @@
     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