Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Nettle
nettle
Commits
0a2aed43
Commit
0a2aed43
authored
Jul 07, 2011
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(read_file): Bug fix, in dependence on initial size on max_size.
Rev: nettle/examples/io.c:1.4
parent
c93fc7c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
examples/io.c
examples/io.c
+7
-2
No files found.
examples/io.c
View file @
0a2aed43
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment