summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorVladimir Kobal <vlad@prokk.net>2018-12-12 18:27:23 +0200
committerPaweł Krupa <pawel@krupa.net.pl>2018-12-12 17:27:23 +0100
commit12933487978a51d1fd4ff4537ee334c0cc1e4d9a (patch)
treed57abedf014c2dcceef344b41405b0501cbb79ba /collectors
parent54f7094c36423b5d938c11a744152d0438d53492 (diff)
Fix mdstat parsing (#4977)
Diffstat (limited to 'collectors')
-rw-r--r--collectors/proc.plugin/proc_mdstat.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/collectors/proc.plugin/proc_mdstat.c b/collectors/proc.plugin/proc_mdstat.c
index 8f489371c8..4e5724204a 100644
--- a/collectors/proc.plugin/proc_mdstat.c
+++ b/collectors/proc.plugin/proc_mdstat.c
@@ -175,13 +175,13 @@ int do_proc_mdstat(int update_every, usec_t dt) {
l++;
words = procfile_linewords(ff, l);
if(likely(words < 2)) continue;
+ if(unlikely(procfile_lineword(ff, l, 0)[0] != '[')) continue;
if(unlikely(words < 7)) {
error("Cannot read /proc/mdstat line. Expected 7 params, read %zu.", words);
continue;
}
- if(unlikely(procfile_lineword(ff, l, 0)[0] != '[')) continue;
- char *word;
+ char *word;
word = procfile_lineword(ff, l, 3);
remove_trailing_chars(word, '%');