]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-common: Factor out checking of CTDB_TEST_MODE
authorMartin Schwenke <mschwenke@ddn.com>
Fri, 15 Aug 2025 04:59:49 +0000 (14:59 +1000)
committerVolker Lendecke <vl@samba.org>
Thu, 25 Sep 2025 07:57:42 +0000 (07:57 +0000)
For use elsewhere.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15921

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
ctdb/common/path.c

index ea3b08f4b2eb04446fc20b1d26246ab884a6da3b..0673bace53107808311a79fd425efa64c424609b 100644 (file)
@@ -45,16 +45,24 @@ struct {
        .vardir = CTDB_VARDIR,
 };
 
-static void path_set_basedir(void)
+static void path_set_test_mode(void)
 {
-       const char *t;
+       const char *t = NULL;
 
        t = getenv("CTDB_TEST_MODE");
        if (t == NULL) {
-               goto done;
+               return;
        }
 
        ctdb_paths.test_mode = true;
+}
+
+static void path_set_basedir(void)
+{
+       path_set_test_mode();
+       if (!ctdb_paths.test_mode) {
+               goto done;
+       }
 
        ctdb_paths.basedir = getenv("CTDB_BASE");
        if (ctdb_paths.basedir == NULL) {