summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/lib/replace/getpass.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c
index 57e28eb981..73333b9021 100644
--- a/source4/lib/replace/getpass.c
+++ b/source4/lib/replace/getpass.c
@@ -187,6 +187,9 @@ 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;
}
}