diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-05-30 18:23:08 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-05-30 18:23:08 +0200 |
commit | 7565bb98a45c51c7a79cbeda9905e5364c49e374 (patch) | |
tree | 35fbfc282a3abe3c4e8a72058f260a0d62b7821b /src/shared/ask-password-api.c | |
parent | 54f8c958f1ebff12b961a1029a2aec451587c206 (diff) |
tree-wide: check colors_enabled() before outputting ANSI color strings
Diffstat (limited to 'src/shared/ask-password-api.c')
-rw-r--r-- | src/shared/ask-password-api.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 4a4bd8d3b8..a86b0db554 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -253,10 +253,12 @@ int ask_password_tty( goto finish; } - loop_write(ttyfd, ANSI_HIGHLIGHT, strlen(ANSI_HIGHLIGHT), false); + if (colors_enabled()) + loop_write(ttyfd, ANSI_HIGHLIGHT, strlen(ANSI_HIGHLIGHT), false); loop_write(ttyfd, message, strlen(message), false); loop_write(ttyfd, " ", 1, false); - loop_write(ttyfd, ANSI_NORMAL, strlen(ANSI_NORMAL), false); + if (colors_enabled()) + loop_write(ttyfd, ANSI_NORMAL, strlen(ANSI_NORMAL), false); new_termios = old_termios; new_termios.c_lflag &= ~(ICANON|ECHO); |