From 0ac5ded812171ac8bec7eed1331e894a33dbe211 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 27 Mar 2007 16:10:16 +0200 Subject: [PATCH] sensors plugin: Fix programming mistakes. --- src/sensors.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sensors.c b/src/sensors.c index 544afd1b..4b0fc3da 100644 --- a/src/sensors.c +++ b/src/sensors.c @@ -153,9 +153,9 @@ static sensors_labeltypes_t known_features[] = { "3.3V", SENSOR_TYPE_VOLTAGE }, { "2.5V", SENSOR_TYPE_VOLTAGE }, { "2.0V", SENSOR_TYPE_VOLTAGE }, - { "12V", SENSOR_TYPE_VOLTAGE }, - { (char *) 0, SENSOR_TYPE_UNKNOWN } + { "12V", SENSOR_TYPE_VOLTAGE } }; +static int known_features_num = STATIC_ARRAY_SIZE (known_features); /* end new naming */ static const char *config_keys[] = @@ -310,7 +310,7 @@ static void sensors_load_conf (void) continue; /* Only known features */ - for (i = 0; known_features[i].type >= 0; i++) + for (i = 0; i < known_features_num; i++) { if (strcmp (data->name, known_features[i].label) != 0) continue; @@ -377,7 +377,8 @@ static void sensors_submit (const char *plugin_instance, value_t values[1]; value_list_t vl = VALUE_LIST_INIT; - if (ignorelist_match (sensor_list, type_instance)) + if ((sensor_list != NULL) + && (ignorelist_match (sensor_list, type_instance))) return; values[0].gauge = val; -- 2.11.0