From: Martin Schwenke Date: Mon, 23 Feb 2026 03:42:17 +0000 (+1100) Subject: ctdb-tools: Fix CID 1681637 - Drop unnecessary if-statements X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=950db430a5172104c8ecfd5bea92d31d8ded9154;p=thirdparty%2Fsamba.git ctdb-tools: Fix CID 1681637 - Drop unnecessary if-statements The first was found by Coverity: >>> CID 1681637: Incorrect expression (IDENTICAL_BRANCHES) >>> The same code is executed when the condition "ret != 0" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed? The second and third are also obvious. Sorry, missed these in review. Signed-off-by: Martin Schwenke Signed-off-by: Anoop C S Autobuild-User(master): Anoop C S Autobuild-Date(master): Mon Feb 23 08:43:29 UTC 2026 on atb-devel-224 --- diff --git a/ctdb/tools/ctdb.c b/ctdb/tools/ctdb.c index 1162cff1817..fb1248a873a 100644 --- a/ctdb/tools/ctdb.c +++ b/ctdb/tools/ctdb.c @@ -1047,9 +1047,6 @@ static int build_json_node_flags(json_t *parent_obj, uint32_t flags) } ret = json_object_set(parent_obj, "flags", flags_map); - if (ret != 0) { - goto done; - } done: json_decref(flags_map); return (ret == 0) ? 0 : 1; @@ -1158,9 +1155,6 @@ static int build_json_nodemap(json_t *root_object, goto done; } ret = json_object_set(root_object, "node_status", nodemap_obj); - if (ret != 0) { - goto done; - } done: json_decref(nodes_obj); json_decref(nodemap_obj); @@ -1231,9 +1225,6 @@ static int build_json_vnnmap(json_t *root_object, goto done; } ret = json_object_set(root_object, "vnn_status", vnnmap_obj); - if (ret != 0) { - goto done; - } done: json_decref(gen_value); json_decref(vnn_lst);