summaryrefslogtreecommitdiff
path: root/source4/lib/replace/getpass.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2008-03-19 10:18:35 +1100
committerAndrew Bartlett <abartlet@samba.org>2008-03-19 10:18:35 +1100
commitb1b37e3776c6e6e20f42140a907e296b65cc0c62 (patch)
tree601f049791bcbd9df9daef64b0b1003dbf1a413b /source4/lib/replace/getpass.c
parent9e6b0c28712ee77ce878809c8576826a3ba08d95 (diff)
parent52669d84722c175555e17a222077f845d9aa958f (diff)
downloadsamba-b1b37e3776c6e6e20f42140a907e296b65cc0c62.tar.gz
samba-b1b37e3776c6e6e20f42140a907e296b65cc0c62.tar.bz2
samba-b1b37e3776c6e6e20f42140a907e296b65cc0c62.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into 4-0-local
(This used to be commit 400c16e7004bc3a881bb6efb99a273cdac87f70c)
Diffstat (limited to 'source4/lib/replace/getpass.c')
-rw-r--r--source4/lib/replace/getpass.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c
index d91d029f6a..73333b9021 100644
--- a/source4/lib/replace/getpass.c
+++ b/source4/lib/replace/getpass.c
@@ -185,7 +185,13 @@ char *rep_getpass(const char *prompt)
buf[0] = 0;
if (!gotintr) {
in_fd = fileno(in);
- fgets(buf, bufsize, in);
+ if (fgets(buf, bufsize, in) == NULL) {
+ buf[0] = 0;
+ if (in && in != stdin) {
+ fclose(in);
+ }
+ return buf;
+ }
}
nread = strlen(buf);
if (nread) {