]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-tcp: Use talloc_strdup() instead of repeating logic
authorMartin Schwenke <mschwenke@ddn.com>
Fri, 5 Jul 2024 05:52:51 +0000 (15:52 +1000)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Aug 2024 13:06:33 +0000 (13:06 +0000)
The node name is already constructed when the nodes file is loaded, so
just copy the node name.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
ctdb/tcp/tcp_connect.c

index 6f5862af5998ea708966f26cac22561da1dd2b5e..7d2a3e649eab38b482820c2fa71d2731465745b6 100644 (file)
@@ -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__);