From: Jeremy Allison Date: Fri, 9 May 2008 21:54:06 +0000 (-0700) Subject: Fix replacement getpass. If we ^C at the prompt echo was left off. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=726d9d168d5b4bca86b478c34204eacb97907443;p=thirdparty%2Fsamba.git Fix replacement getpass. If we ^C at the prompt echo was left off. Fix bug #5456. Karolin please pull for 3.2-stable. Jeremy. --- diff --git a/source/lib/replace/getpass.c b/source/lib/replace/getpass.c index 73333b90219..0be618fc916 100644 --- a/source/lib/replace/getpass.c +++ b/source/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); }