summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-05-09 14:51:45 -0700
committerStefan Metzmacher <metze@samba.org>2008-09-14 18:19:59 +0200
commitb2c4838543fc2e42771a34cc9aa05f03793b88fc (patch)
treeb50c75ca8298b7765271ccb4b242aec6558f6b04 /source4
parent9a222474bb891e0b1839ecad009e5d0420d4b308 (diff)
downloadsamba-b2c4838543fc2e42771a34cc9aa05f03793b88fc.tar.gz
samba-b2c4838543fc2e42771a34cc9aa05f03793b88fc.tar.bz2
samba-b2c4838543fc2e42771a34cc9aa05f03793b88fc.zip
Fix replacement getpass. If we ^C at the prompt echo was left off.
Jeremy. (cherry picked from commit e54c71954ae484fe4a4e195db33440490e78e256) (This used to be commit d61a86b8cdb4dd474611baadc61a0c37db0f8e62)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/replace/getpass.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c
index 73333b9021..0be618fc91 100644
--- a/source4/lib/replace/getpass.c
+++ b/source4/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);
}