diff options
Diffstat (limited to 'source4/lib/replace/getpass.c')
-rw-r--r-- | source4/lib/replace/getpass.c | 8 |
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) { |