]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-daemon: Use path_etcdir_append() to construct some paths
authorMartin Schwenke <mschwenke@ddn.com>
Tue, 6 Aug 2024 03:49:01 +0000 (13:49 +1000)
committerAnoop C S <anoopcs@samba.org>
Tue, 8 Oct 2024 05:34:30 +0000 (05:34 +0000)
No need to use CTDB_BASE directly.

Signed-off-by: Martin Schwenke <mschwenke@ddn.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
ctdb/server/ctdb_takeover.c
ctdb/server/ctdbd.c

index d3f20b57b5fd22deba65582475d2f002d1304945..ccd9a92e4fe96120abe4444e6a5df997f4d10463 100644 (file)
@@ -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;
index f0f625331871e2e7954fa2c57870bd582b7e2443..23abb393e74caf51010b22b2e35af05a7705969a 100644 (file)
@@ -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;