summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2020-08-28 15:28:50 +0200
committerChristian Göttsche <cgzones@googlemail.com>2020-08-28 16:46:50 +0200
commit05a5fdc47faac329a80f9259b12731899ede6644 (patch)
treeeff180b6baa4e07abeb9fd072cd54eaa339f50f2
parentaf84d3dfa9d217096c709bad2860689b89cc1c2f (diff)
Ignore sscanf return value of /proc/stat
Found by Coverity
-rw-r--r--linux/LinuxProcessList.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/linux/LinuxProcessList.c b/linux/LinuxProcessList.c
index d09797fb..27ddf79d 100644
--- a/linux/LinuxProcessList.c
+++ b/linux/LinuxProcessList.c
@@ -1142,10 +1142,10 @@ static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) {
char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
if (!ok) buffer[0] = '\0';
if (i == 0)
- sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
+ (void) sscanf(buffer, "cpu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
else {
int cpuid;
- sscanf(buffer, "cpu%4d %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
+ (void) sscanf(buffer, "cpu%4d %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu %16llu", &cpuid, &usertime, &nicetime, &systemtime, &idletime, &ioWait, &irq, &softIrq, &steal, &guest, &guestnice);
assert(cpuid == i - 1);
}
// Guest time is already accounted in usertime