]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: disable colors when displaying cylon when systemd.log_color=off (#3495)
authorFranck Bui <fbui@suse.com>
Fri, 10 Jun 2016 16:33:15 +0000 (18:33 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 10 Jun 2016 16:33:15 +0000 (18:33 +0200)
src/core/manager.c

index 14d97a87d07314ee2f1c37c165988e7ab935f47b..ec8acdff5bc00656e44ec624fabd21f221e6fe3f 100644 (file)
@@ -136,23 +136,28 @@ static void draw_cylon(char buffer[], size_t buflen, unsigned width, unsigned po
         if (pos > 1) {
                 if (pos > 2)
                         p = mempset(p, ' ', pos-2);
-                p = stpcpy(p, ANSI_RED);
+                if (log_get_show_color())
+                        p = stpcpy(p, ANSI_RED);
                 *p++ = '*';
         }
 
         if (pos > 0 && pos <= width) {
-                p = stpcpy(p, ANSI_HIGHLIGHT_RED);
+                if (log_get_show_color())
+                        p = stpcpy(p, ANSI_HIGHLIGHT_RED);
                 *p++ = '*';
         }
 
-        p = stpcpy(p, ANSI_NORMAL);
+        if (log_get_show_color())
+                p = stpcpy(p, ANSI_NORMAL);
 
         if (pos < width) {
-                p = stpcpy(p, ANSI_RED);
+                if (log_get_show_color())
+                        p = stpcpy(p, ANSI_RED);
                 *p++ = '*';
                 if (pos < width-1)
                         p = mempset(p, ' ', width-1-pos);
-                strcpy(p, ANSI_NORMAL);
+                if (log_get_show_color())
+                        strcpy(p, ANSI_NORMAL);
         }
 }