summaryrefslogtreecommitdiffstats
path: root/replace/getpass.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2008-09-25 01:51:49 -0400
committerSimo Sorce <idra@samba.org>2008-09-25 02:30:18 -0400
commitf698831f0ae0cd86225eb647ae4aeb813f08d3b5 (patch)
tree55689de966245292e6ae517480c668ce993caf70 /replace/getpass.c
parentcced59be44cbc2204314bdf77a35b41b81bf4097 (diff)
downloadsssd-f698831f0ae0cd86225eb647ae4aeb813f08d3b5.tar.gz
sssd-f698831f0ae0cd86225eb647ae4aeb813f08d3b5.tar.xz
sssd-f698831f0ae0cd86225eb647ae4aeb813f08d3b5.zip
Sync with upstream changes
Diffstat (limited to 'replace/getpass.c')
-rw-r--r--replace/getpass.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/replace/getpass.c b/replace/getpass.c
index 73333b902..0be618fc9 100644
--- a/replace/getpass.c
+++ b/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);
}