From 8598a76681ae0fc58b33f1e6ac4eecf0f71c326f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 1 Nov 2021 09:41:17 +0100 Subject: [PATCH] print_file_contents: fix colors Commit https://github.com/i3/i3status/commit/f0b5758c72f331f598d18f6127e3d55d803af5d7 broke the END_COLOR macro because the outwalk variable was not updated. --- src/print_file_contents.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/print_file_contents.c b/src/print_file_contents.c index b66321a..936d447 100644 --- a/src/print_file_contents.c +++ b/src/print_file_contents.c @@ -59,11 +59,12 @@ void print_file_contents(yajl_gen json_gen, char *buffer, const char *title, con {.name = "%error", .value = strerror(errno)}}; const size_t num = sizeof(placeholders) / sizeof(placeholder_t); - buffer = format_placeholders(walk, &placeholders[0], num); - + char *formatted = format_placeholders(walk, &placeholders[0], num); + strcpy(outwalk, formatted); + outwalk += strlen(formatted); + free(formatted); free(buf); END_COLOR; OUTPUT_FULL_TEXT(buffer); - free(buffer); }