From 5df527f7afc7b366072693ad8c40ea418d9c50d1 Mon Sep 17 00:00:00 2001 From: KWSys Upstream Date: Thu, 25 May 2023 09:42:59 -0400 Subject: KWSys 2023-05-25 (c9f0da47) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Code extracted from: https://gitlab.kitware.com/utils/kwsys.git at commit c9f0da473ac2c21b25c1819141c4828dd238b4d3 (master). Upstream Shortlog ----------------- Timo Röhling (1): 9119f1a1 SystemInformation: Tolerate empty /proc/cpuinfo --- SystemInformation.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SystemInformation.cxx b/SystemInformation.cxx index 20e2edb..7f8485e 100644 --- a/SystemInformation.cxx +++ b/SystemInformation.cxx @@ -3453,6 +3453,10 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile() fileSize++; } fclose(fd); + if (fileSize < 2) { + std::cout << "No data in /proc/cpuinfo" << std::endl; + return false; + } buffer.resize(fileSize - 2); // Number of logical CPUs (combination of multiple processors, multi-core // and SMT) -- cgit v0.12