From 36898d0240408b775a0ab73fa0c0b90e7ea7f86a Mon Sep 17 00:00:00 2001 From: Phillip Whelan Date: Thu, 17 Aug 2023 12:08:18 -0400 Subject: [PATCH] flb_utils: suppress errno when file is empty but readable. # Summary Suppress a false error log when flb_utils_read_file reads empty files. Signed-off-by: Phillip Whelan --- src/flb_utils.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/flb_utils.c b/src/flb_utils.c index ac876175a56..d0864d4d9f1 100644 --- a/src/flb_utils.c +++ b/src/flb_utils.c @@ -1303,7 +1303,9 @@ 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) { - flb_errno(); + if (bytes < 0) { + flb_errno(); + } flb_free(buf); fclose(fp); return -1;