From 1a1280ba701738d3e0e7890bc8213e554f326c22 Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Tue, 29 Aug 2023 11:16:09 -0400 Subject: [PATCH] utils: use ferror and not math to check file handler for error. Signed-off-by: Phillip Whelan --- src/flb_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flb_utils.c b/src/flb_utils.c index d0864d4d9f1..c2b2f58a6f7 100644 --- a/src/flb_utils.c +++ b/src/flb_utils.c @@ -1303,7 +1303,7 @@ int flb_utils_read_file(char *path, char **out_buf, size_t *out_size) bytes = fread(buf, st.st_size, 1, fp); if (bytes < 1) { - if (bytes < 0) { + if (ferror(fp)) { flb_errno(); } flb_free(buf);