FreeBSD: silence unsigned integer underflow

freebsd/FreeBSDProcessList.c:252:47: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'
      #0 0x397c32 in FreeBSDProcessList_scanCPU /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:252:47
      #1 0x38fe76 in ProcessList_goThroughEntries /root/workspace/htop/htop/freebsd/FreeBSDProcessList.c:438:4
      #2 0x35ef9a in ProcessList_scan /root/workspace/htop/htop/ProcessList.c:618:4
      #3 0x31ee9e in main /root/workspace/htop/htop/htop.c:468:4
      #4 0x26bbcf in _start /usr/src/lib/csu/amd64/crt1.c:76:7
This commit is contained in:
Christian Göttsche 2021-03-21 21:12:30 +01:00 committed by cgzones
parent 9a8221568a
commit 99cde7edec
1 changed files with 1 additions and 1 deletions

View File

@ -249,7 +249,7 @@ static inline void FreeBSDProcessList_scanCPU(ProcessList* pl) {
cpuData->temperature = NAN;
cpuData->frequency = NAN;
const int coreId = (cpus == 1) ? 0 : (i - 1);
const int coreId = (cpus == 1) ? 0 : ((int)i - 1);
if (coreId < 0)
continue;