]> git.ipfire.org Git - thirdparty/collectd.git/commit
plugin: processes: use a const ref string and strlen i.s.o. magic offset
authorBart De Vos <bart-de-vos@telenet.be>
Mon, 26 Aug 2019 13:38:12 +0000 (15:38 +0200)
committerBart De Vos <bart-de-vos@telenet.be>
Fri, 30 Aug 2019 07:11:34 +0000 (09:11 +0200)
commitf93354d30a6b0c574f3a09094e1a4982bfd96adf
tree497e612c7aeeb97b7eab8c9d9655b3f9d67b015d
parent9114d76499ba00d29641d8e49baccae89613abcd
plugin: processes: use a const ref string and strlen i.s.o. magic offset

The simple parser is based on 'strstr', whereas the actual data does
include a white-space character to separate the 'id' (procs_running)
from the 'value' (a number). Yet parsing the number can off course only
take place 'after' the white-space. Subsequently, not finding a
'white-space' should be treated as an error condition.

Adding the 'white-space' in const string and defining the offset based
on 'strlen' fixes this properly.
src/processes.c