From 2f082668bd9f74044b94f395149f7561b29c7867 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Sun, 1 Jun 2008 23:40:30 -0400 Subject: [PATCH] ENH: fix crash on dash17 linux where the parsing of the proc file must not have worked right --- Source/kwsys/SystemInformation.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index f8a37bad2..373f95943 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;