summaryrefslogtreecommitdiff
path: root/source/lib/replace/getpass.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-02-23 10:42:43 +0100
committerStefan Metzmacher <metze@samba.org>2008-03-18 16:40:46 +0100
commit8f58d39c0c621e9da85308d721a146352cc4939e (patch)
treecf901f95fe314f8e8fe8e114c25bac98db78482b /source/lib/replace/getpass.c
parent98ee8c84300757d778733a458c6ca3e6022b40ea (diff)
downloadsamba-8f58d39c0c621e9da85308d721a146352cc4939e.tar.gz
Check the return value of fgets
(cherry picked from commit b8aaa9a69fd6217ce0387ef8e84f316706186d70)
Diffstat (limited to 'source/lib/replace/getpass.c')
-rw-r--r--source/lib/replace/getpass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/lib/replace/getpass.c b/source/lib/replace/getpass.c
index d91d029f6a7..57e28eb9815 100644
--- a/source/lib/replace/getpass.c
+++ b/source/lib/replace/getpass.c
@@ -185,7 +185,10 @@ 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;
+ return buf;
+ }
}
nread = strlen(buf);
if (nread) {