Skip to content
Snippets Groups Projects
Commit 0a2aed43 authored by Niels Möller's avatar Niels Möller
Browse files

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

Rev: nettle/examples/io.c:1.4
parent c93fc7c6
No related branches found
No related tags found
No related merge requests found
...@@ -89,7 +89,12 @@ read_file(const char *name, unsigned max_size, char **contents) ...@@ -89,7 +89,12 @@ read_file(const char *name, unsigned max_size, char **contents)
else else
size = 100; 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); (!max_size || done < max_size) && !feof(f);
size *= 2) size *= 2)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment