]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tools: Fix signed/unsigned comparisons by declaring extra variable
authorMartin Schwenke <martin@meltin.net>
Fri, 24 May 2019 03:50:07 +0000 (13:50 +1000)
committerAmitay Isaacs <amitay@samba.org>
Wed, 5 Jun 2019 10:25:49 +0000 (10:25 +0000)
This needs an extra variable because variable i has been used in both
signed and unsigned contexts.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/ctdb.c

index 84333ed1d49df3c3d8021b03a9b47394ea00360c..38f9e5e17814178deb4ad67715ccadace400cc5c 100644 (file)
@@ -2363,6 +2363,7 @@ static int control_detach(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
        uint8_t db_flags;
        struct ctdb_node_map *nodemap;
        int recmode;
+       unsigned int j;
        int ret, ret2, i;
 
        if (argc < 1) {
@@ -2386,29 +2387,29 @@ static int control_detach(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                return 1;
        }
 
-       for (i=0; i<nodemap->num; i++) {
+       for (j=0; j<nodemap->num; j++) {
                uint32_t value;
 
-               if (nodemap->node[i].flags & NODE_FLAGS_DISCONNECTED) {
+               if (nodemap->node[j].flags & NODE_FLAGS_DISCONNECTED) {
                        continue;
                }
-               if (nodemap->node[i].flags & NODE_FLAGS_DELETED) {
+               if (nodemap->node[j].flags & NODE_FLAGS_DELETED) {
                        continue;
                }
-               if (nodemap->node[i].flags & NODE_FLAGS_INACTIVE) {
+               if (nodemap->node[j].flags & NODE_FLAGS_INACTIVE) {
                        fprintf(stderr, "Database cannot be detached on"
                                " inactive (stopped or banned) node %u\n",
-                               nodemap->node[i].pnn);
+                               nodemap->node[j].pnn);
                        return 1;
                }
 
                ret = ctdb_ctrl_get_tunable(mem_ctx, ctdb->ev, ctdb->client,
-                                           nodemap->node[i].pnn, TIMEOUT(),
+                                           nodemap->node[j].pnn, TIMEOUT(),
                                            "AllowClientDBAttach", &value);
                if (ret != 0) {
                        fprintf(stderr,
                                "Unable to get tunable AllowClientDBAttach"
-                               " from node %u\n", nodemap->node[i].pnn);
+                               " from node %u\n", nodemap->node[j].pnn);
                        return ret;
                }
 
@@ -2416,7 +2417,7 @@ static int control_detach(TALLOC_CTX *mem_ctx, struct ctdb_context *ctdb,
                        fprintf(stderr,
                                "Database access is still active on node %u."
                                " Set AllowclientDBAttach=0 on all nodes.\n",
-                               nodemap->node[i].pnn);
+                               nodemap->node[j].pnn);
                        return 1;
                }
        }