ctdb-tools: Use path_socket() in ctdb tool
authorMartin Schwenke <martin@meltin.net>
Thu, 10 May 2018 06:46:18 +0000 (16:46 +1000)
committerAmitay Isaacs <amitay@samba.org>
Tue, 6 Nov 2018 06:16:14 +0000 (07:16 +0100)
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/ctdb.c

index 0652a205dbdd60311f1c6ec5c43d554d745c6fd5..8fa1ce63203fed32e41d235fc79c36cef57bab04 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "common/db_hash.h"
 #include "common/logging.h"
+#include "common/path.h"
 #include "protocol/protocol.h"
 #include "protocol/protocol_api.h"
 #include "protocol/protocol_util.h"
@@ -6119,9 +6120,10 @@ static int process_command(const struct ctdb_cmd *cmd, int argc,
                goto fail;
        }
 
-       ctdb_socket = getenv("CTDB_SOCKET");
+       ctdb_socket = path_socket(ctdb, "ctdbd");
        if (ctdb_socket == NULL) {
-               ctdb_socket = CTDB_SOCKET;
+               fprintf(stderr, "Memory allocation error\n");
+               goto fail;
        }
 
        ret = ctdb_client_init(ctdb, ctdb->ev, ctdb_socket, &ctdb->client);