From 4c12a36eb5b44fb08d0461e6fa77fcdb4a128433 Mon Sep 17 00:00:00 2001 From: Martin Schwenke Date: Fri, 15 Aug 2025 14:59:49 +1000 Subject: [PATCH] ctdb-common: Factor out checking of CTDB_TEST_MODE For use elsewhere. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15921 Signed-off-by: Martin Schwenke --- ctdb/common/path.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ctdb/common/path.c b/ctdb/common/path.c index ea3b08f4b2e..0673bace531 100644 --- a/ctdb/common/path.c +++ b/ctdb/common/path.c @@ -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) { -- 2.47.3