]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_cpu_temperature.c
Error handling: Never output null as full_text (JSON), prefix messages with i3status...
[i3/i3status] / src / print_cpu_temperature.c
index 41c3c9c6097ff04e7d09044737a3d01a0ca47265..8e7d7f9c4c23e0392c0e1940ec249e9b6dd24cfe 100644 (file)
@@ -38,10 +38,11 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
         char *outwalk = buffer;
         static char buf[16];
 
-        if (path == NULL) {
+        if (path == NULL)
                 asprintf(&thermal_zone, THERMAL_ZONE, zone);
-                path = thermal_zone;
-        }
+        else
+                asprintf(&thermal_zone, path, zone);
+        path = thermal_zone;
 
         INSTANCE(path);
 
@@ -112,5 +113,6 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
         return;
 error:
 #endif
-        (void)fputs("Cannot read temperature\n", stderr);
+        OUTPUT_FULL_TEXT("cant read temp");
+        (void)fputs("i3status: Cannot read temperature. Verify that you have a thermal zone in /sys/class/thermal or disable the cpu_temperature module in your i3status config.\n", stderr);
 }