X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fprint_cpu_temperature.c;h=569ea6064e4aa234a2e157f68037610ffd01517a;hb=fadd4d89b1e196e009d5cd5cc2f6c3bdda83b12e;hp=431664ed9d0f2ccbe47535b0945ef70f3a76619e;hpb=9f08fe297a59553e6a0f1c0078014afa1209e51b;p=i3%2Fi3status diff --git a/src/print_cpu_temperature.c b/src/print_cpu_temperature.c index 431664e..569ea60 100644 --- a/src/print_cpu_temperature.c +++ b/src/print_cpu_temperature.c @@ -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++) = '%'; } }