ctdb-daemon: Add a helper variable
authorMartin Schwenke <martin@meltin.net>
Wed, 28 Jul 2021 00:27:42 +0000 (10:27 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 9 Sep 2021 01:46:49 +0000 (01:46 +0000)
Simplifies a subsequent change.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14784
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_daemon.c

index 57f80235e7c8b615baf607cdb769f3d0048a1b9d..3071e3cad54d8791383afe62526eba6a0f915091 100644 (file)
@@ -1237,26 +1237,28 @@ failed:
 
 static void initialise_node_flags (struct ctdb_context *ctdb)
 {
+       struct ctdb_node *node = NULL;
        unsigned int i;
 
        /* Always found: PNN correctly set just before this is called */
        for (i = 0; i < ctdb->num_nodes; i++) {
-               if (ctdb->pnn == ctdb->nodes[i]->pnn) {
+               node = ctdb->nodes[i];
+               if (ctdb->pnn == node->pnn) {
                        break;
                }
        }
 
-       ctdb->nodes[i]->flags &= ~NODE_FLAGS_DISCONNECTED;
+       node->flags &= ~NODE_FLAGS_DISCONNECTED;
 
        /* do we start out in DISABLED mode? */
        if (ctdb->start_as_disabled != 0) {
                D_ERR("This node is configured to start in DISABLED state\n");
-               ctdb->nodes[i]->flags |= NODE_FLAGS_DISABLED;
+               node->flags |= NODE_FLAGS_DISABLED;
        }
        /* do we start out in STOPPED mode? */
        if (ctdb->start_as_stopped != 0) {
                D_ERR("This node is configured to start in STOPPED state\n");
-               ctdb->nodes[i]->flags |= NODE_FLAGS_STOPPED;
+               node->flags |= NODE_FLAGS_STOPPED;
        }
 }