Commit 0a2aed43 authored by Niels Möller's avatar Niels Möller

(read_file): Bug fix, in dependence on initial size on max_size.

Rev: nettle/examples/io.c:1.4
parent c93fc7c6
......@@ -88,8 +88,13 @@ read_file(const char *name, unsigned max_size, char **contents)
size = max_size;
else
size = 100;
for (size = 100, done = 0;
/* FIXME: The use of feof and ferror in this loop is a bit confused
(but I think it is still correct). We should check the return
value of fread, and call feof and/or ferror when we get a short
item count. */
for (done = 0;
(!max_size || done < max_size) && !feof(f);
size *= 2)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment