From ee0231076e36bffabeb0bfd9f84304bf49ee0dcc Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> 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 --- SystemInformation.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 4a941426..daf7ba3f 100644 --- a/SystemInformation.cxx +++ b/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; -- GitLab