summaryrefslogtreecommitdiffstats
path: root/source/lib/replace
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-09 14:51:45 -0700
committerJeremy Allison <jra@samba.org>2008-05-09 14:51:45 -0700
commite54c71954ae484fe4a4e195db33440490e78e256 (patch)
tree4ad9a1c3bdae2c0c987c6a5ebed8004b36af2b8a /source/lib/replace
parent4221937b68e2414295279b27c5f12a80f826ed4b (diff)
downloadsamba-e54c71954ae484fe4a4e195db33440490e78e256.tar.gz
samba-e54c71954ae484fe4a4e195db33440490e78e256.tar.xz
samba-e54c71954ae484fe4a4e195db33440490e78e256.zip
Fix replacement getpass. If we ^C at the prompt echo was left off.
Jeremy.
Diffstat (limited to 'source/lib/replace')
-rw-r--r--source/lib/replace/getpass.c7
1 files changed, 2 insertions, 5 deletions
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);
}