1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

ctdb-server: Add some local variables

Improve readability by not repeating the complex expression now
assigned to addr.  ctdb_sys_have_ip() is called in both arms of the
if/else, so call it once when declaring the new variable.

Modernise debug macros while touching lines.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
This commit is contained in:
Martin Schwenke 2024-09-29 14:06:51 +10:00 committed by Anoop C S
parent 33e28deeef
commit a15167aafe

View File

@ -2356,18 +2356,19 @@ static int verify_local_ip_allocation(struct ctdb_recoverd *rec)
} }
for (j=0; j<ips->num; j++) { for (j=0; j<ips->num; j++) {
ctdb_sock_addr *addr = &ips->ips[j].addr;
bool have_ip = ctdb_sys_have_ip(addr);
if (ips->ips[j].pnn == rec->pnn) { if (ips->ips[j].pnn == rec->pnn) {
if (!ctdb_sys_have_ip(&ips->ips[j].addr)) { if (!have_ip) {
DEBUG(DEBUG_ERR, D_ERR("Assigned IP %s not on an interface\n",
("Assigned IP %s not on an interface\n", ctdb_addr_to_str(addr));
ctdb_addr_to_str(&ips->ips[j].addr)));
need_takeover_run = true; need_takeover_run = true;
} }
} else { } else {
if (ctdb_sys_have_ip(&ips->ips[j].addr)) { if (have_ip) {
DEBUG(DEBUG_ERR, D_ERR("IP %s incorrectly on an interface\n",
("IP %s incorrectly on an interface\n", ctdb_addr_to_str(addr));
ctdb_addr_to_str(&ips->ips[j].addr)));
need_takeover_run = true; need_takeover_run = true;
} }
} }