summaryrefslogtreecommitdiffstats
path: root/ctdb/server
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2013-10-15 14:10:58 +1100
committerMartin Schwenke <martin@meltin.net>2013-10-22 15:37:54 +1100
commit4adc8f4f09bc2d32307917cc632d7d8c0b63e975 (patch)
tree87c12032049274c07a39145f951b55f2e3eb9b6e /ctdb/server
parentf9ce563135ed036b48eb14a097e002c29aed97a7 (diff)
downloadsamba-4adc8f4f09bc2d32307917cc632d7d8c0b63e975.tar.gz
samba-4adc8f4f09bc2d32307917cc632d7d8c0b63e975.tar.xz
samba-4adc8f4f09bc2d32307917cc632d7d8c0b63e975.zip
ctdbd: Default for event_script_dir should use CTDB_BASE
Also get rid of ctdb_set_event_script_dir(). It creates an unnecessary copy of something that will be around for the lifetime of the process. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 21b4d1aba00902f1eee0cbf4f082b0794fd5b738)
Diffstat (limited to 'ctdb/server')
-rw-r--r--ctdb/server/ctdb_takeover.c10
-rw-r--r--ctdb/server/ctdbd.c15
2 files changed, 10 insertions, 15 deletions
diff --git a/ctdb/server/ctdb_takeover.c b/ctdb/server/ctdb_takeover.c
index ecb0dbe5fab..91f30302d77 100644
--- a/ctdb/server/ctdb_takeover.c
+++ b/ctdb/server/ctdb_takeover.c
@@ -1135,16 +1135,6 @@ static int ctdb_add_public_address(struct ctdb_context *ctdb,
return 0;
}
-/*
- setup the event script directory
-*/
-int ctdb_set_event_script_dir(struct ctdb_context *ctdb, const char *script_dir)
-{
- ctdb->event_script_dir = talloc_strdup(ctdb, script_dir);
- CTDB_NO_MEMORY(ctdb, ctdb->event_script_dir);
- return 0;
-}
-
static void ctdb_check_interfaces_event(struct event_context *ev, struct timed_event *te,
struct timeval t, void *private_data)
{
diff --git a/ctdb/server/ctdbd.c b/ctdb/server/ctdbd.c
index b04971760d4..f19b48ff2ed 100644
--- a/ctdb/server/ctdbd.c
+++ b/ctdb/server/ctdbd.c
@@ -54,7 +54,7 @@ static struct {
} options = {
.nlist = NULL,
.transport = "tcp",
- .event_script_dir = ETCDIR "/ctdb/events.d",
+ .event_script_dir = NULL,
.logfile = LOGDIR "/log.ctdb",
.db_dir = VARDIR "/ctdb",
.db_dir_persistent = VARDIR "/ctdb/persistent",
@@ -296,10 +296,15 @@ int main(int argc, const char *argv[])
}
}
- ret = ctdb_set_event_script_dir(ctdb, options.event_script_dir);
- if (ret == -1) {
- DEBUG(DEBUG_ALERT,("Unable to setup event script directory\n"));
- exit(1);
+ if (options.event_script_dir != NULL) {
+ ctdb->event_script_dir = options.event_script_dir;
+ } else {
+ ctdb->event_script_dir = talloc_asprintf(ctdb, "%s/events.d",
+ getenv("CTDB_BASE"));
+ if (ctdb->event_script_dir == NULL) {
+ DEBUG(DEBUG_ALERT,(__location__ " Out of memory\n"));
+ exit(1);
+ }
}
if (options.notification_script != NULL) {