From: =?utf-8?q?Timo_R=C3=B6hling?= Date: Sun, 28 May 2023 12:02:38 +0200 Subject: Tolerate empty /proc/cpuinfo Forwarded: https://gitlab.kitware.com/utils/kwsys/-/merge_requests/284 https://gitlab.kitware.com/cmake/cmake/-/merge_requests/8504 --- Source/kwsys/SystemInformation.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 20e2edb..7f8485e 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/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)