]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tools: Fix CID 1681637 - Drop unnecessary if-statements
authorMartin Schwenke <mschwenke@ddn.com>
Mon, 23 Feb 2026 03:42:17 +0000 (14:42 +1100)
committerAnoop C S <anoopcs@samba.org>
Mon, 23 Feb 2026 08:43:29 +0000 (08:43 +0000)
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 <mschwenke@ddn.com>
Signed-off-by: Anoop C S <anoopcs@samba.org>
Autobuild-User(master): Anoop C S <anoopcs@samba.org>
Autobuild-Date(master): Mon Feb 23 08:43:29 UTC 2026 on atb-devel-224

ctdb/tools/ctdb.c

index 1162cff1817dd2a03d62faa6ef1f895237dbfa7f..fb1248a873a981c7750420b15ccc2b7d01a297cd 100644 (file)
@@ -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);