From: Martin Schwenke Date: Fri, 15 Aug 2025 02:08:47 +0000 (+1000) Subject: ctdb-pmda: Do not directly support CTDB_SOCKET environment variable X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c4794e40529c63c696ecc3f8f27c810c22dd63a5;p=thirdparty%2Fsamba.git ctdb-pmda: Do not directly support CTDB_SOCKET environment variable Always use whatever CTDB uses in the current environment. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15921 Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke --- diff --git a/ctdb/utils/pmda/pmda_ctdb.c b/ctdb/utils/pmda/pmda_ctdb.c index 5c09aca7b84..edf6ffc136b 100644 --- a/ctdb/utils/pmda/pmda_ctdb.c +++ b/ctdb/utils/pmda/pmda_ctdb.c @@ -28,6 +28,8 @@ #include "lib/util/time.h" #include "lib/util/blocking.h" +#include "common/path.h" + #include "client/client.h" #include "client/client_sync.h" @@ -58,9 +60,7 @@ * CTDB PMDA * * This PMDA connects to the locally running ctdbd daemon and pulls - * statistics for export via PCP. The ctdbd Unix domain socket path can be - * specified with the CTDB_SOCKET environment variable, otherwise the default - * path is used. + * statistics for export via PCP. */ /* @@ -200,7 +200,7 @@ pmda_ctdb_disconnected(void *args) static int pmda_ctdb_daemon_connect(void) { - const char *socket_name; + char *socket_name = NULL; int ret; ev = tevent_context_init(NULL); @@ -209,9 +209,9 @@ pmda_ctdb_daemon_connect(void) return -1; } - socket_name = getenv("CTDB_SOCKET"); + socket_name = path_socket(ev, "ctdbd"); if (socket_name == NULL) { - socket_name = CTDB_SOCKET; + goto err_ev; } ret = ctdb_client_init(ev, ev, socket_name, &client); @@ -224,6 +224,7 @@ pmda_ctdb_daemon_connect(void) ctdb_client_set_disconnect_callback(client, pmda_ctdb_disconnected, NULL); + talloc_free(socket_name); return 0; err_ev: