summaryrefslogtreecommitdiff
path: root/source4
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
commit7fb3963032ce8f6b7f5c652dd69d3315cae897ea (patch)
tree4add4183bbaa5e89cc4653db1006581e74eb6aca /source4
parent4d16e17e04c6fd62ebfa36085bcf38d2507737e6 (diff)
downloadsamba-7fb3963032ce8f6b7f5c652dd69d3315cae897ea.tar.gz
samba-7fb3963032ce8f6b7f5c652dd69d3315cae897ea.tar.bz2
samba-7fb3963032ce8f6b7f5c652dd69d3315cae897ea.zip
Check the return value of fgets
(cherry picked from commit b8aaa9a69fd6217ce0387ef8e84f316706186d70) (This used to be commit 8f58d39c0c621e9da85308d721a146352cc4939e)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/replace/getpass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source4/lib/replace/getpass.c b/source4/lib/replace/getpass.c
index d91d029f6a..57e28eb981 100644
--- a/source4/lib/replace/getpass.c
+++ b/source4/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) {