container.c: distinguish ferror/feof from other errors
This commit is contained in:
parent
c6ac388f86
commit
3ce1418ce5
|
@ -159,9 +159,15 @@ static int read_all_elements(const struct container *const list, const size_t n,
|
|||
memset(&done, 0, sizeof done);
|
||||
|
||||
for (size_t i = 0; i < sizeof done / sizeof *done; i++)
|
||||
if (feof(f) || ferror(f)
|
||||
|| read_element(list, n, f, done))
|
||||
{
|
||||
if (feof(f) || ferror(f))
|
||||
{
|
||||
fprintf(stderr, "feof or ferror found\n");
|
||||
goto end;
|
||||
}
|
||||
else if (read_element(list, n, f, done))
|
||||
goto end;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < sizeof done / sizeof *done; i++)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue