From d315f33dee9825bdb11efb79cc4b4a89da5fb89c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 13 May 2008 14:08:58 +0200 Subject: [PATCH] Attempt to fix bug 5456: restore echoing on SIGINT in password prompt --- source/lib/replace/getpass.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/source/lib/replace/getpass.c b/source/lib/replace/getpass.c index 73333b9..a71458b 100644 --- a/source/lib/replace/getpass.c +++ b/source/lib/replace/getpass.c @@ -186,6 +186,17 @@ char *rep_getpass(const char *prompt) if (!gotintr) { in_fd = fileno(in); if (fgets(buf, bufsize, in) == NULL) { + + /* Restore echoing. */ + if (echo_off) { + FILE *in_tty; + if (gotintr && in_fd == -1) + in_tty = fopen ("/dev/tty", "w+"); + if (in_tty != NULL) + tcsetattr(fileno(in_tty), TCSANOW, &t); + fclose(in_tty); + } + buf[0] = 0; if (in && in != stdin) { fclose(in); -- 1.5.3.6