Code

sensors plugin: Fix programming mistakes.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 27 Mar 2007 14:10:16 +0000 (16:10 +0200)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 27 Mar 2007 14:10:16 +0000 (16:10 +0200)
src/sensors.c

index 544afd1b37e256dfb87b1e2becba6738a70673ff..4b0fc3da2c695d67d0912c1b1b8d7d53097d175b 100644 (file)
@@ -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;