ctdb-daemon: Fix signed/unsigned comparisons by using constant
authorMartin Schwenke <martin@meltin.net>
Fri, 7 Jun 2019 20:40:40 +0000 (06:40 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 5 Jul 2019 05:03:23 +0000 (05:03 +0000)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_takeover.c
ctdb/server/ctdb_takeover_helper.c

index 844e3c32866c232dbb0589e9f06cff3bcdc5f7f9..3ac569a953a764d4e2f84185d24af2b4aeb8629f 100644 (file)
@@ -298,7 +298,7 @@ static void ctdb_vnn_unassign_iface(struct ctdb_context *ctdb,
        }
        vnn->iface = NULL;
        if (vnn->pnn == ctdb->pnn) {
-               vnn->pnn = -1;
+               vnn->pnn = CTDB_UNKNOWN_PNN;
        }
 }
 
@@ -772,7 +772,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
                return -1;
        }
 
-       if (vnn->pnn != ctdb->pnn && have_ip && vnn->pnn != -1) {
+       if (vnn->pnn != ctdb->pnn && have_ip && vnn->pnn != CTDB_UNKNOWN_PNN) {
                DEBUG(DEBUG_CRIT,(__location__ " takeoverip of IP %s is known to the kernel, "
                                  "and we have it on iface[%s], but it was assigned to node %d"
                                  "and we are node %d, banning ourself\n",
@@ -782,7 +782,7 @@ int32_t ctdb_control_takeover_ip(struct ctdb_context *ctdb,
                return -1;
        }
 
-       if (vnn->pnn == -1 && have_ip) {
+       if (vnn->pnn == CTDB_UNKNOWN_PNN && have_ip) {
                /* This will cause connections to be reset and
                 * reestablished.  However, this is a very unusual
                 * situation and doing this will completely repair the
index 8740838cfdde7c607b82ddfcf49a3ee672bcc5f7..254b48f07596aef60602f51a471b7e7dfb0ccaa0 100644 (file)
@@ -466,7 +466,7 @@ static struct tevent_req *take_ip_send(TALLOC_CTX *mem_ctx,
                struct take_ip_one_state *substate;
                struct ctdb_public_ip ip;
 
-               if (tmp_ip->pnn == -1) {
+               if (tmp_ip->pnn == CTDB_UNKNOWN_PNN) {
                        /* IP will be unassigned */
                        continue;
                }