summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-02-23 10:42:43 +0100
committerVolker Lendecke <vl@samba.org>2008-02-23 11:04:13 +0100
commitcef18563bb56b75dc45be494fab8e0ba5f1ab512 (patch)
tree956203b5ec121b13d0c75d6ce4d8186e8acb74cc
parent9712e3c11c69e2a40ea7c156dd3515dafed833ea (diff)
downloadsamba-cef18563bb56b75dc45be494fab8e0ba5f1ab512.tar.gz
samba-cef18563bb56b75dc45be494fab8e0ba5f1ab512.tar.bz2
samba-cef18563bb56b75dc45be494fab8e0ba5f1ab512.zip
Check the return value of fgets
(This used to be commit b8aaa9a69fd6217ce0387ef8e84f316706186d70)
-rw-r--r--source3/lib/replace/getpass.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c
index d91d029f6a..57e28eb981 100644
--- a/source3/lib/replace/getpass.c
+++ b/source3/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) {