From 79fe56e4d1ae447432ce0d2e3da0085fd3d88d54 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Tue, 12 Nov 2024 19:42:37 +0900 Subject: [PATCH 1/2] config_format: cf_fluentbit: Handle static config correctly Signed-off-by: Hiroshi Hatake --- src/config_format/flb_cf_fluentbit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/config_format/flb_cf_fluentbit.c b/src/config_format/flb_cf_fluentbit.c index df77afd9c53..1ac967cbfd5 100644 --- a/src/config_format/flb_cf_fluentbit.c +++ b/src/config_format/flb_cf_fluentbit.c @@ -502,7 +502,7 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx, * workaround to retrieve the lines. */ size_t off = 0; - while (static_fgets(buf, FLB_CF_BUF_SIZE, in_data, &off)) { + while (static_fgets(buf, FLB_DEFAULT_CF_BUF_SIZE, in_data, &off)) { #else /* normal mode, read lines into a buffer */ /* note that we use "fgets_ptr" so we can continue reading after realloc */ @@ -518,10 +518,15 @@ static int read_config(struct flb_cf *cf, struct local_ctx *ctx, /* after a successful line read, restore "fgets_ptr" to point to the * beginning of buffer */ fgets_ptr = buf; - } else if (feof(f)) { + } +#ifndef FLB_HAVE_STATIC_CONF + /* When using static conf build, FILE pointer is absent and + * always as NULL. */ + else if (feof(f)) { /* handle EOF without a newline(CRLF or LF) */ fgets_ptr = buf; } +#endif #ifndef FLB_HAVE_STATIC_CONF else { /* resize the line buffer */ From 964901e02a2259da6b1d11162590c136ddda1644 Mon Sep 17 00:00:00 2001 From: Hiroshi Hatake Date: Tue, 12 Nov 2024 19:43:00 +0900 Subject: [PATCH 2/2] config_format: cf_yaml: Follow the change of variable name Signed-off-by: Hiroshi Hatake --- src/config_format/flb_cf_yaml.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/config_format/flb_cf_yaml.c b/src/config_format/flb_cf_yaml.c index 609f9b7aafd..c2b0d50efec 100644 --- a/src/config_format/flb_cf_yaml.c +++ b/src/config_format/flb_cf_yaml.c @@ -2767,8 +2767,8 @@ static struct parser_state *state_create(struct file_state *parent, struct file_ #else - s->file->name = flb_sds_create("***static***"); - s->file->path = flb_sds_create("***static***"); + state->file->name = flb_sds_create("***static***"); + state->file->path = flb_sds_create("***static***"); #endif