From: Martin Schwenke Date: Fri, 5 Jul 2024 05:52:51 +0000 (+1000) Subject: ctdb-tcp: Use talloc_strdup() instead of repeating logic X-Git-Tag: tdb-1.4.13~1347 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2c75bb868733c631e1526e5555233ffdeb2ad8ff;p=thirdparty%2Fsamba.git ctdb-tcp: Use talloc_strdup() instead of repeating logic The node name is already constructed when the nodes file is loaded, so just copy the node name. Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke --- diff --git a/ctdb/tcp/tcp_connect.c b/ctdb/tcp/tcp_connect.c index 6f5862af599..7d2a3e649ea 100644 --- a/ctdb/tcp/tcp_connect.c +++ b/ctdb/tcp/tcp_connect.c @@ -496,9 +496,7 @@ static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) goto failed; } - ctdb->name = talloc_asprintf(ctdb, "%s:%u", - ctdb_addr_to_str(ctdb->address), - ctdb_addr_to_port(ctdb->address)); + ctdb->name = talloc_strdup(ctdb, ctdb->nodes[i]->name); if (ctdb->name == NULL) { ctdb_set_error(ctdb, "Out of memory at %s:%d", __FILE__, __LINE__);