ctdb-daemon: Compare interface pointers instead of using strcmp(3)
authorMartin Schwenke <martin@meltin.net>
Thu, 25 Aug 2016 01:48:36 +0000 (11:48 +1000)
committerAmitay Isaacs <amitay@samba.org>
Thu, 8 Sep 2016 04:57:21 +0000 (06:57 +0200)
If the interfaces have different names then they are different
interfaces.

Also, move assignment of new_name just above where is is first used.

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

index 1540e367394d4310e1278aacefbdeab86ca61470..02e5c3d397d33da2c04205ea99249fefade4753c 100644 (file)
@@ -655,9 +655,7 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
                return -1;
        }
 
-       new_name = ctdb_vnn_iface_string(vnn);
-       if (old_name != NULL && new_name != NULL &&
-           strcmp(old_name, new_name) == 0) {
+       if (old == vnn->iface) {
                /* A benign update from one interface onto itself.
                 * no need to run the eventscripts in this case, just return
                 * success.
@@ -676,6 +674,7 @@ static int32_t ctdb_do_updateip(struct ctdb_context *ctdb,
        vnn->update_in_flight = true;
        talloc_set_destructor(state, ctdb_updateip_destructor);
 
+       new_name = ctdb_vnn_iface_string(vnn);
        DEBUG(DEBUG_NOTICE,("Update of IP %s/%u from "
                            "interface %s to %s\n",
                            ctdb_addr_to_str(&vnn->public_address),