From 2dd30c3cc5d8888eb55c6e4696891b0c1821ebf6 Mon Sep 17 00:00:00 2001 From: YingJie Fu Date: Tue, 13 Aug 2024 19:19:52 -0700 Subject: [PATCH] core: fix configuration type cast issue on s390x Signed-off-by: YingJie Fu --- src/flb_config_map.c | 8 ++++---- tests/internal/config_map.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/flb_config_map.c b/src/flb_config_map.c index 4db55411cb0..f09a689a0bb 100644 --- a/src/flb_config_map.c +++ b/src/flb_config_map.c @@ -583,7 +583,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co int ret; int len; char *base; - char *m_bool; + int *m_bool; int *m_i_num; double *m_d_num; size_t *m_s_num; @@ -651,10 +651,10 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co } else if (m->type == FLB_CONFIG_MAP_TIME) { m_i_num = (int *) (base + m->offset); - *m_i_num = m->value.val.s_num; + *m_i_num = m->value.val.i_num; } else if (m->type == FLB_CONFIG_MAP_BOOL) { - m_bool = (char *) (base + m->offset); + m_bool = (int *) (base + m->offset); *m_bool = m->value.val.boolean; } else if (m->type >= FLB_CONFIG_MAP_CLIST || @@ -779,7 +779,7 @@ int flb_config_map_set(struct mk_list *properties, struct mk_list *map, void *co *m_d_num = atof(kv->val); } else if (m->type == FLB_CONFIG_MAP_BOOL) { - m_bool = (char *) (base + m->offset); + m_bool = (int *) (base + m->offset); ret = flb_utils_bool(kv->val); if (ret == -1) { flb_error("[config map] invalid value for boolean property '%s=%s'", diff --git a/tests/internal/config_map.c b/tests/internal/config_map.c index b709d016d17..941b815e902 100644 --- a/tests/internal/config_map.c +++ b/tests/internal/config_map.c @@ -13,8 +13,8 @@ struct context { /* Single values */ int num_int; size_t size; - time_t time; - char boolean; + int time; + int boolean; double num_double; flb_sds_t string; struct mk_list *list1;