From: Martin Schwenke Date: Fri, 6 Jul 2018 05:30:31 +0000 (+1000) Subject: ctdb-tests: Use path_socket() in test client tools X-Git-Tag: tdb-1.3.17~911 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd021596da68baf4ef6be7c2a18c64077c5c8ade;p=thirdparty%2Fsamba.git ctdb-tests: Use path_socket() in test client tools Just leak the memory allocated by path_socket(). This is only used in short-lived test programs, so it isn't worth the hassle of plumbing a talloc context through several layers to get here. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/tests/src/test_options.c b/ctdb/tests/src/test_options.c index e732a79c8ff..cfce51aeeb6 100644 --- a/ctdb/tests/src/test_options.c +++ b/ctdb/tests/src/test_options.c @@ -19,12 +19,14 @@ #include "replace.h" +#include #include #include #include "lib/util/debug.h" #include "common/logging.h" +#include "common/path.h" #include "tests/src/test_options.h" @@ -66,19 +68,14 @@ static struct poptOption options_database[] = { static void set_defaults_basic(struct test_options *opts) { - const char *ctdb_socket; - /* Set default options */ - opts->socket = CTDB_SOCKET; + opts->socket = path_socket(NULL, "ctdbd"); /* leaked */ + assert(opts->socket != NULL); + opts->timelimit = 10; opts->num_nodes = 1; opts->debugstr = "ERR"; opts->interactive = 0; - - ctdb_socket = getenv("CTDB_SOCKET"); - if (ctdb_socket != NULL) { - opts->socket = ctdb_socket; - } } static void set_defaults_database(struct test_options *opts)