Make sure colorful_output variable is initialized.
Patch status: merged
Patch by Emil Mikulic
To apply this patch, use:
curl http://cr.i3wm.org/patch/25/raw.patch | git am
b/src/print_cpu_temperature.c
13 |
@@ -38,7 +38,7 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const |
14 |
#ifdef THERMAL_ZONE |
15 |
const char *walk; |
16 |
char *outwalk = buffer; |
17 |
- bool colorful_output; |
18 |
+ bool colorful_output = false; |
19 |
|
20 |
if (path == NULL) |
21 |
asprintf(&thermal_zone, THERMAL_ZONE, zone); |
22 |
@@ -69,8 +69,10 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const |
23 |
colorful_output = true; |
24 |
} |
25 |
outwalk += sprintf(outwalk, "%ld", (temp/1000)); |
26 |
- if (colorful_output) |
27 |
+ if (colorful_output) { |
28 |
END_COLOR; |
29 |
+ colorful_output = false; |
30 |
+ } |
31 |
} |
32 |
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
33 |
int sysctl_rslt; |
34 |
@@ -116,8 +118,10 @@ void print_cpu_temperature_info(yajl_gen json_gen, char *buffer, int zone, const |
35 |
|
36 |
outwalk += sprintf(outwalk, "%.2f", MUKTOC(sensor.value)); |
37 |
|
38 |
- if (colorful_output) |
39 |
+ if (colorful_output) { |
40 |
END_COLOR; |
41 |
+ colorful_output = false; |
42 |
+ } |
43 |
} |
44 |
} |
45 |
} |