From 5cc9c5f48d56d53fd45f5d21f35176fb94746c30 Mon Sep 17 00:00:00 2001 From: George Kennedy Date: Fri, 15 Nov 2024 20:59:22 +0000 Subject: [PATCH] adaptived: enhance json config file error handling Run the error enum returned by json_tokener_parse_verbose() through json_tokener_error_desc() for a string with a human readable description of the error. Signed-off-by: George Kennedy Acked-by: Sidhartha Kumar Signed-off-by: Tom Hromatka --- adaptived/src/parse.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/adaptived/src/parse.c b/adaptived/src/parse.c index d81aa91..94591e1 100644 --- a/adaptived/src/parse.c +++ b/adaptived/src/parse.c @@ -624,6 +624,8 @@ static int parse_json(struct adaptived_ctx * const ctx, const char * const buf) obj = json_tokener_parse_verbose(buf, &err); if (!obj || err) { + if (err) + adaptived_err("%s: %s\n", __func__, json_tokener_error_desc(err)); ret = -EINVAL; goto out; }