[Lldb-commits] [lldb] r191568 - Fix OS Version reporting bug detected by TestPlatform for some Linux 3.x kernels that do not report the update version

Daniel Malea daniel.malea at intel.com
Fri Sep 27 14:34:03 PDT 2013


Author: dmalea
Date: Fri Sep 27 16:34:03 2013
New Revision: 191568

URL: http://llvm.org/viewvc/llvm-project?rev=191568&view=rev
Log:
Fix OS Version reporting bug detected by TestPlatform for some Linux 3.x kernels that do not report the update version
- should resolve the current failure on the Linux clang buildbot


Modified:
    lldb/trunk/source/Host/linux/Host.cpp

Modified: lldb/trunk/source/Host/linux/Host.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/linux/Host.cpp?rev=191568&r1=191567&r2=191568&view=diff
==============================================================================
--- lldb/trunk/source/Host/linux/Host.cpp (original)
+++ lldb/trunk/source/Host/linux/Host.cpp Fri Sep 27 16:34:03 2013
@@ -213,7 +213,14 @@ Host::GetOSVersion(uint32_t &major,
         return false;
 
     status = sscanf(un.release, "%u.%u.%u", &major, &minor, &update);
-    return status == 3;
+    if (status == 3)
+        return true;
+
+    // Some kernels omit the update version, so try looking for just "X.Y" and
+    // set update to 0.
+    update = 0;
+    status = sscanf(un.release, "%u.%u", &major, &minor);
+    return status == 2;
 }
 
 lldb::DataBufferSP





More information about the lldb-commits mailing list