]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_cpu_temperature.c
Merge pull request #301 from wmarvel/issue300
[i3/i3status] / src / print_cpu_temperature.c
index 431664ed9d0f2ccbe47535b0945ef70f3a76619e..569ea6064e4aa234a2e157f68037610ffd01517a 100644 (file)
@@ -223,7 +223,7 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
         asprintf(&thermal_zone, THERMAL_ZONE, zone);
     else {
         static glob_t globbuf;
-        if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0)
+        if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) != 0)
             die("glob() failed\n");
         if (globbuf.gl_pathc == 0) {
             /* No glob matches, the specified path does not contain a wildcard. */
@@ -250,11 +250,13 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const
     for (walk = selected_format; *walk != '\0'; walk++) {
         if (*walk != '%') {
             *(outwalk++) = *walk;
-            continue;
-        }
-        if (BEGINS_WITH(walk + 1, "degrees")) {
+
+        } else if (BEGINS_WITH(walk + 1, "degrees")) {
             outwalk += sprintf(outwalk, "%s", temperature.formatted_value);
             walk += strlen("degrees");
+
+        } else {
+            *(outwalk++) = '%';
         }
     }