From: Christian Hesse Date: Wed, 11 Mar 2020 19:39:07 +0000 (+0100) Subject: shared/ask-password-api: do not show hint on echo X-Git-Tag: v246-rc1~755 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddee0e815ed5500722019bcb807957ea6846212d;p=thirdparty%2Fsystemd.git shared/ask-password-api: do not show hint on echo Giving --echo to systemd-ask-password allows to echo the user input instead of masking it. This is useful when querying for usernames or similar. Showing "(press TAB for no echo)" does not make sense there, so do not. Note that pressing TAB or ESC still disables echo. --- diff --git a/src/shared/ask-password-api.c b/src/shared/ask-password-api.c index 6abcbfca9d0..0fc5501e621 100644 --- a/src/shared/ask-password-api.c +++ b/src/shared/ask-password-api.c @@ -469,7 +469,7 @@ int ask_password_tty( (void) loop_write(ttyfd, message, strlen(message), false); (void) loop_write(ttyfd, " ", 1, false); - if (!(flags & ASK_PASSWORD_SILENT)) { + if (!(flags & ASK_PASSWORD_SILENT) && !(flags & ASK_PASSWORD_ECHO)) { if (use_color) (void) loop_write(ttyfd, ANSI_GREY, STRLEN(ANSI_GREY), false); (void) loop_write(ttyfd, PRESS_TAB, strlen(PRESS_TAB), false);