summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemInformation.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2008-06-02 03:40:30 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2008-06-02 03:40:30 (GMT)
commit2f082668bd9f74044b94f395149f7561b29c7867 (patch)
tree9c7a675681b54b52a95fd800dea3457849e1b746 /Source/kwsys/SystemInformation.cxx
parent735b77798dfcff8b13c271612b81cf36619d7234 (diff)
downloadCMake-2f082668bd9f74044b94f395149f7561b29c7867.zip
CMake-2f082668bd9f74044b94f395149f7561b29c7867.tar.gz
CMake-2f082668bd9f74044b94f395149f7561b29c7867.tar.bz2
ENH: fix crash on dash17 linux where the parsing of the proc file must not have worked right
Diffstat (limited to 'Source/kwsys/SystemInformation.cxx')
-rw-r--r--Source/kwsys/SystemInformation.cxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index f8a37ba..373f959 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -2199,7 +2199,12 @@ int SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
this->NumberOfPhysicalCPU=
this->NumberOfLogicalCPU = atoi(cpucount.c_str());
#endif
-
+ // gotta have one, and if this is 0 then we get a / by 0n
+ // beter to have a bad answer than a crash
+ if(this->NumberOfPhysicalCPU <= 0)
+ {
+ this->NumberOfPhysicalCPU = 1;
+ }
// LogicalProcessorsPerPhysical>1 => hyperthreading.
this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;