From b275f44a4a7f5338d8dd6cb2baf80b61b549913e Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 12 Jul 2021 09:29:06 -0300 Subject: [PATCH] ospf6d: fix build problem with ancient json-c versions Some CI VMs are using really old versions of json-c (pre 2013 [1]) that expect filenames to be passed as "char *" instead of "const char *". Add some explicit casts to fix the resulting compiler errors on those VMs (passing "char *" when the API expects "const char *" is fine). Hopefully this commit should be reverted once the CI is updated to use newer versions of json-c. [1] https://github.com/json-c/json-c/commit/20e4708c Signed-off-by: Renato Westphal --- ospf6d/ospf6_gr.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ospf6d/ospf6_gr.c b/ospf6d/ospf6_gr.c index c1d345d541..40893ed998 100644 --- a/ospf6d/ospf6_gr.c +++ b/ospf6d/ospf6_gr.c @@ -478,7 +478,7 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6) inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME; - json = json_object_from_file(OSPF6D_GR_STATE); + json = json_object_from_file((char *)OSPF6D_GR_STATE); if (json == NULL) json = json_object_new_object(); @@ -506,7 +506,8 @@ static void ospf6_gr_nvm_update(struct ospf6 *ospf6) json_object_int_add(json_instance, "timestamp", time(NULL) + ospf6->gr_info.grace_period); - json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY); + json_object_to_file_ext((char *)OSPF6D_GR_STATE, json, + JSON_C_TO_STRING_PRETTY); json_object_free(json); } @@ -522,7 +523,7 @@ static void ospf6_gr_nvm_delete(struct ospf6 *ospf6) inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME; - json = json_object_from_file(OSPF6D_GR_STATE); + json = json_object_from_file((char *)OSPF6D_GR_STATE); if (json == NULL) json = json_object_new_object(); @@ -534,7 +535,8 @@ static void ospf6_gr_nvm_delete(struct ospf6 *ospf6) json_object_object_del(json_instances, inst_name); - json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY); + json_object_to_file_ext((char *)OSPF6D_GR_STATE, json, + JSON_C_TO_STRING_PRETTY); json_object_free(json); } @@ -553,7 +555,7 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6) inst_name = ospf6->name ? ospf6->name : VRF_DEFAULT_NAME; - json = json_object_from_file(OSPF6D_GR_STATE); + json = json_object_from_file((char *)OSPF6D_GR_STATE); if (json == NULL) json = json_object_new_object(); @@ -597,7 +599,8 @@ void ospf6_gr_nvm_read(struct ospf6 *ospf6) json_object_object_del(json_instances, inst_name); - json_object_to_file_ext(OSPF6D_GR_STATE, json, JSON_C_TO_STRING_PRETTY); + json_object_to_file_ext((char *)OSPF6D_GR_STATE, json, + JSON_C_TO_STRING_PRETTY); json_object_free(json); } -- 2.39.5