summaryrefslogtreecommitdiff
path: root/source4/lib/replace/getpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/replace/getpass.c')
-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);
}