From 3ce1418ce5141eac6e526dcfb7a824a7731bbe03 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Tue, 15 Feb 2022 21:34:27 +0100 Subject: [PATCH] container.c: distinguish ferror/feof from other errors --- src/container/src/container.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/container/src/container.c b/src/container/src/container.c index 008ca58..5c568a9 100644 --- a/src/container/src/container.c +++ b/src/container/src/container.c @@ -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++) {