dbwrap: move sockname variable and call to lp_ctdbd_socket into context
authorRalph Boehme <slow@samba.org>
Sat, 18 Nov 2017 07:56:09 +0000 (08:56 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 12 Sep 2018 20:25:19 +0000 (22:25 +0200)
sockname is only needed in a cluster.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/dbwrap/dbwrap_open.c

index 33bf9696998e1aaebc44d938f214a16baeac88da..0a7edabdbc3234e503d2ce759c48f5017707cc1a 100644 (file)
@@ -65,7 +65,6 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
 {
        struct db_context *result = NULL;
        const char *base;
-       const char *sockname;
 
        if (!DBWRAP_LOCK_ORDER_VALID(lock_order)) {
                errno = EINVAL;
@@ -126,9 +125,10 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
                }
        }
 
-       sockname = lp_ctdbd_socket();
-
        if (lp_clustering()) {
+               const char *sockname;
+
+               sockname = lp_ctdbd_socket();
                if (!socket_exist(sockname)) {
                        DEBUG(1, ("ctdb socket does not exist - is ctdb not "
                                  "running?\n"));