diff options
author | Brad King <brad.king@kitware.com> | 2024-10-23 23:16:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-10-26 10:01:09 (GMT) |
commit | 51ed0eba18988af38ae9da0603b47d534ca50439 (patch) | |
tree | 2fcafab7a85a679e2c353bed737b53b57e65563c /Source | |
parent | f60b4c553e120ac7aef376bb06c7eea97a404da1 (diff) | |
download | CMake-51ed0eba18988af38ae9da0603b47d534ca50439.zip CMake-51ed0eba18988af38ae9da0603b47d534ca50439.tar.gz CMake-51ed0eba18988af38ae9da0603b47d534ca50439.tar.bz2 |
KWSys: SystemInformation: Add missing EOF check when reading /proc/cpuinfo
Backport KWSys upstream commit `6e847d08b` (SystemInformation: Add
missing EOF check when reading /proc/cpuinfo, 2024-10-23) to the
CMake 3.31 release branch.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/kwsys/SystemInformation.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx index 4efea54..933d649 100644 --- a/Source/kwsys/SystemInformation.cxx +++ b/Source/kwsys/SystemInformation.cxx @@ -3405,8 +3405,9 @@ bool SystemInformationImplementation::RetrieveInformationFromCpuInfoFile() } size_t fileSize = 0; - while (!feof(fd)) { - buffer += static_cast<char>(fgetc(fd)); + int fc; + while ((fc = fgetc(fd)) != EOF) { + buffer += static_cast<char>(fc); fileSize++; } fclose(fd); |