From 5c57fce289cf14a4df81bdfd64d1469580bceff3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 30 Jul 2007 20:15:31 +0200 Subject: [PATCH] sensors plugin: Fix the use of the ignorelist, so it matches the documentation. --- ChangeLog | 6 ++++++ src/sensors.c | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cd3f54b8..25dcc3ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-07-30, Version 4.0.6 + * sensors plugin: Fix the ignorelist functionality: Only the `type + instance' was used to match against the list, but the documentation + told otherwise. This release fixes the code, so it complies with the + documentation. + 2007-07-05, Version 4.0.5 * Portability: More fixes for OpenBSD have been included. diff --git a/src/sensors.c b/src/sensors.c index e1bc7aaf..fde8dcd7 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -347,12 +347,24 @@ static void sensors_submit (const char *plugin_instance, const char *type, const char *type_instance, double val) { + char match_key[1024]; + int status; + value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - if ((sensor_list != NULL) - && (ignorelist_match (sensor_list, type_instance))) + status = snprintf (match_key, sizeof (match_key), "%s/%s-%s", + plugin_instance, type, type_instance); + if ((status < 1) || (status >= sizeof (match_key))) return; + match_key[sizeof (match_key) - 1] = '\0'; + + if (sensor_list != NULL) + { + DEBUG ("sensors plugin: Checking ignorelist for `%s'", match_key); + if (ignorelist_match (sensor_list, match_key)) + return; + } values[0].gauge = val; -- 2.30.2