From: Martin Schwenke Date: Tue, 6 Aug 2024 03:49:01 +0000 (+1000) Subject: ctdb-daemon: Use path_etcdir_append() to construct some paths X-Git-Tag: tdb-1.4.13~986 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b6151faf4589a355aadac1839ab6a98a5b3f335e;p=thirdparty%2Fsamba.git ctdb-daemon: Use path_etcdir_append() to construct some paths No need to use CTDB_BASE directly. Signed-off-by: Martin Schwenke Reviewed-by: Anoop C S --- diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c index d3f20b57b5f..ccd9a92e4fe 100644 --- a/ctdb/server/ctdb_takeover.c +++ b/ctdb/server/ctdb_takeover.c @@ -44,6 +44,7 @@ #include "common/system_socket.h" #include "common/common.h" #include "common/logging.h" +#include "common/path.h" #include "conf/ctdb_config.h" @@ -1145,13 +1146,8 @@ int ctdb_set_public_addresses(struct ctdb_context *ctdb) /* If no public addresses file given then try the default */ if (ctdb->public_addresses_file == NULL) { - const char *b = getenv("CTDB_BASE"); - if (b == NULL) { - DBG_ERR("CTDB_BASE not set\n"); - return -1; - } - ctdb->public_addresses_file = talloc_asprintf( - ctdb, "%s/%s", b, "public_addresses"); + ctdb->public_addresses_file = path_etcdir_append( + ctdb, "public_addresses"); if (ctdb->public_addresses_file == NULL) { DBG_ERR("Out of memory\n"); return -1; diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c index f0f62533187..23abb393e74 100644 --- a/ctdb/server/ctdbd.c +++ b/ctdb/server/ctdbd.c @@ -372,17 +372,13 @@ int main(int argc, const char *argv[]) ctdb_tunables_load(ctdb); - ctdb->event_script_dir = talloc_asprintf(ctdb, - "%s/events/legacy", - ctdb_base); + ctdb->event_script_dir = path_etcdir_append(ctdb, "events/legacy"); if (ctdb->event_script_dir == NULL) { DBG_ERR("Out of memory\n"); goto fail; } - ctdb->notification_script = talloc_asprintf(ctdb, - "%s/notify.sh", - ctdb_base); + ctdb->notification_script = path_etcdir_append(ctdb, "notify.sh"); if (ctdb->notification_script == NULL) { D_ERR("Unable to set notification script\n"); goto fail;