]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-debug: don't colorize if a redirect is used
authorEric Leblond <eric@regit.org>
Thu, 24 Sep 2015 12:20:42 +0000 (14:20 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 8 Oct 2015 08:36:29 +0000 (10:36 +0200)
It is better to disable the color mode when a redirect of stderr
is done to avoid getting colorized output in the generated file.

src/util-debug.c

index f1ac0463e505182323ff41d3d77dbf7a22502893..d9af08c4381a2bedde3e5d80bb7e8d50c4511c1e 100644 (file)
@@ -776,7 +776,7 @@ static inline SCLogOPIfaceCtx *SCLogInitConsoleOPIface(const char *log_format,
     }
     iface_ctx->log_level = tmp_log_level;
 
-    if (isatty(fileno(stdout))) {
+    if (isatty(fileno(stdout)) && isatty(fileno(stderr))) {
         iface_ctx->use_color = TRUE;
     }