From: Jeremy Allison Date: Fri, 9 May 2008 21:51:45 +0000 (-0700) Subject: Fix replacement getpass. If we ^C at the prompt echo was left off. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d61a86b8cdb4dd474611baadc61a0c37db0f8e62;p=thirdparty%2Fsamba.git Fix replacement getpass. If we ^C at the prompt echo was left off. Jeremy. (cherry picked from commit e54c71954ae484fe4a4e195db33440490e78e256) --- 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); }