util: remove LIST_ADDTAIL macro
[mesa.git] / src / gallium / auxiliary / hud / hud_sensors_temp.c
index c26e7b9b2a70d8304090168987e4b458ca34b314..f99752f38df8e03879d91cf1e54f54af37b2edcd 100644 (file)
@@ -34,6 +34,7 @@
 #include "util/os_time.h"
 #include "os/os_thread.h"
 #include "util/u_memory.h"
+#include "util/u_string.h"
 #include <stdio.h>
 #include <unistd.h>
 #include <dirent.h>
@@ -122,6 +123,9 @@ get_sensor_values(struct sensors_temp_info *sti)
    case SENSORS_POWER_CURRENT:
       sf = sensors_get_subfeature(sti->chip, sti->feature,
                                   SENSORS_SUBFEATURE_POWER_INPUT);
+      if (!sf)
+          sf = sensors_get_subfeature(sti->chip, sti->feature,
+                                      SENSORS_SUBFEATURE_POWER_AVERAGE);
       if (sf) {
          /* Sensors API returns in WATTs, even though driver is reporting mW,
           * convert back to mW */
@@ -256,8 +260,8 @@ create_object(const char *chipname, const char *featurename,
    sti->mode = mode;
    sti->chip = (sensors_chip_name *) chip;
    sti->feature = feature;
-   strcpy(sti->chipname, chipname);
-   strcpy(sti->featurename, featurename);
+   snprintf(sti->chipname, sizeof(sti->chipname), "%s", chipname);
+   snprintf(sti->featurename, sizeof(sti->featurename), "%s", featurename);
    snprintf(sti->name, sizeof(sti->name), "%s.%s", sti->chipname,
       sti->featurename);