From 717d66b0e7a05eb0d22c85fda7a4448885e7f1ec Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Sun, 18 Feb 2024 23:16:31 +0100 Subject: Fixed missing statistics updating for unknown mapping keys in collectd/influxd. Signed-off-by: Toni Uhlig --- examples/c-influxd/c-influxd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'examples/c-influxd/c-influxd.c') diff --git a/examples/c-influxd/c-influxd.c b/examples/c-influxd/c-influxd.c index ed6f2e99e..c58c36ae3 100644 --- a/examples/c-influxd/c-influxd.c +++ b/examples/c-influxd/c-influxd.c @@ -946,6 +946,8 @@ static ssize_t influxd_map_index(char const * const json_key, struct global_map const * const map, size_t map_length) { + ssize_t unknown_key = -1; + if (json_key == NULL || key_length == 0) { return -1; @@ -955,6 +957,7 @@ static ssize_t influxd_map_index(char const * const json_key, { if (map[i].json_key == NULL) { + unknown_key = i; continue; } @@ -964,7 +967,7 @@ static ssize_t influxd_map_index(char const * const json_key, } } - return -1; + return unknown_key; } static int influxd_map_flow_u8(struct nDPIsrvd_socket * const sock, -- cgit v1.2.3