From 16735840ee19560bbb66106f3333083e5f25e356 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 30 Jan 2019 09:20:44 -0800 Subject: [PATCH] gpu: nvgpu: unit: Fix --no-color bug The color itself was not being printed when `--no-color' was set but the reset color escape sequence was still being printed. This fixes that bug so that now, when `--no-color' is specified neither the color or the reset sequence is printed. This cleans up the log mess in GVS runs. JIRA NVGPU-1737 Change-Id: I8f612d3f920b78e25ba606add703b310da36d7a7 Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/2007626 Reviewed-by: Philip Elcan Reviewed-by: Nicolas Benech GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- userspace/src/io.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/userspace/src/io.c b/userspace/src/io.c index 21ac54da6..903237bb5 100644 --- a/userspace/src/io.c +++ b/userspace/src/io.c @@ -35,12 +35,16 @@ static void __core_print_file(struct unit_fw *fw, FILE *filp, const char *prefix, const char *msg, const char *color) { - if (color == NULL || args(fw)->no_color) + const char *reset = C_RESET; + + if (color == NULL || args(fw)->no_color) { color = ""; + reset = ""; + } fprintf(filp, "[%s%s%s] %s%s%s", - color, prefix, C_RESET, - color, msg, C_RESET); + color, prefix, reset, + color, msg, reset); } __attribute__((format (printf, 3, 4)))