summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/logging.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/logging.c b/src/logging.c
index 9b37bf53..e6e09e06 100644
--- a/src/logging.c
+++ b/src/logging.c
@@ -398,11 +398,12 @@ static void _output(struct log_target *target, unsigned int subsys,
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
- ret = snprintf(buf + offset, rem, "%s",
- target->use_color ? "\033[0;m" : "");
- if (ret < 0)
- goto err;
- OSMO_SNPRINTF_RET(ret, rem, offset, len);
+ if (target->use_color) {
+ ret = snprintf(buf + offset, rem, "\033[0;m");
+ if (ret < 0)
+ goto err;
+ OSMO_SNPRINTF_RET(ret, rem, offset, len);
+ }
err:
buf[sizeof(buf)-1] = '\0';
target->output(target, level, buf);