From 48b8bacfe4b0cc7369d7e7d9387a010ffb6fee2a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 May 2008 14:51:45 -0700 Subject: Fix replacement getpass. If we ^C at the prompt echo was left off. Jeremy. (This used to be commit e54c71954ae484fe4a4e195db33440490e78e256) --- source3/lib/replace/getpass.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source3') diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c index 73333b9021..0be618fc91 100644 --- a/source3/lib/replace/getpass.c +++ b/source3/lib/replace/getpass.c @@ -187,10 +187,6 @@ char *rep_getpass(const char *prompt) in_fd = fileno(in); if (fgets(buf, bufsize, in) == NULL) { buf[0] = 0; - if (in && in != stdin) { - fclose(in); - } - return buf; } } nread = strlen(buf); @@ -201,8 +197,9 @@ char *rep_getpass(const char *prompt) /* Restore echoing. */ if (echo_off) { - if (gotintr && in_fd == -1) + if (gotintr && in_fd == -1) { in = fopen ("/dev/tty", "w+"); + } if (in != NULL) tcsetattr (fileno (in), TCSANOW, &t); } -- cgit