fix for no lines being read in /proc/interrupts and /proc/softirqs #66
Costa Tsaousis (ktsaou) committed
Apr 2, 2016 at 17:33 UTC
d04cdfce5f34a7586eda314488c042031fb83719
2 files changed
+10
src/proc_interrupts.c
+5
@@ -46,6 +46,11 @@ int do_proc_interrupts(int update_every, unsigned long long dt) {
46
uint32_t lines = procfile_lines(ff), l;
47
uint32_t words = procfile_linewords(ff, 0), w;
48
49
+ if(!lines) {
50
+ error("Cannot read /proc/interrupts, zero lines reported.");
51
+ return 1;
52
+ }
53
+
54
// find how many CPUs are there
55
if(cpus == -1) {
56
cpus = 0;
src/proc_softirqs.c
+5
@@ -46,6 +46,11 @@ int do_proc_softirqs(int update_every, unsigned long long dt) {
46
uint32_t lines = procfile_lines(ff), l;
47
uint32_t words = procfile_linewords(ff, 0), w;
48
49
+ if(!lines) {
50
+ error("Cannot read /proc/softirqs, zero lines reported.");
51
+ return 1;
52
+ }
53
+
54
// find how many CPUs are there
55
if(cpus == -1) {
56
cpus = 0;