ctdb-common: Allow path_socket() to use $CTDB_SOCKET
authorMartin Schwenke <martin@meltin.net>
Tue, 18 Sep 2018 06:19:40 +0000 (16:19 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 6 Nov 2018 06:16:13 +0000 (07:16 +0100)
Use of CTDB_SOCKET is being generally removed.  However, this override
is being added to allow test code outside of ctdb/ to be able to
specify the socket, if desired.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/common/path.c

index 165664650edb1e1ea80f1c1e259cc07feaf5efaa..69e606b4ede40a11aa7cdb58deaf3c2e92f23690 100644 (file)
@@ -188,6 +188,14 @@ char *path_config(TALLOC_CTX *mem_ctx)
 
 char *path_socket(TALLOC_CTX *mem_ctx, const char *daemon)
 {
+       if (strcmp(daemon, "ctdbd") == 0) {
+               const char *t = getenv("CTDB_SOCKET");
+
+               if (t != NULL) {
+                       return talloc_strdup(mem_ctx, t);
+               }
+       }
+
        return talloc_asprintf(mem_ctx,
                               "%s/%s.socket",
                               path_rundir(),