From a2abc78c875ec530410410da0bdf7fbe2f78b9a5 Mon Sep 17 00:00:00 2001
From: Martin Schwenke <martin@meltin.net>
Date: Thu, 25 Aug 2016 11:48:36 +1000
Subject: [PATCH] ctdb-daemon: Compare interface pointers instead of using
 strcmp(3)

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 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index 1540e367394..02e5c3d397d 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -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),