summaryrefslogtreecommitdiff
path: root/ctdb/common/cmdline.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-05-01 06:34:55 +1000
committerAndrew Tridgell <tridge@samba.org>2007-05-01 06:34:55 +1000
commit5b8c4bba5a9477fb232381f5d03f106ff1ebdf3e (patch)
tree811a9ced11e673764303187f4ee1fc8ca18095a3 /ctdb/common/cmdline.c
parentbbf358cfcfac9025343ad415d0246ea90bf54a49 (diff)
downloadsamba-5b8c4bba5a9477fb232381f5d03f106ff1ebdf3e.tar.gz
auto-determine listen address by attempting to bind to each address in the cluster in turn
(This used to be ctdb commit 2fab9f96df2e5b5c51c860fd65caf0e926a63e34)
Diffstat (limited to 'ctdb/common/cmdline.c')
-rw-r--r--ctdb/common/cmdline.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c
index 4ffb032ed1e..23c93edea12 100644
--- a/ctdb/common/cmdline.c
+++ b/ctdb/common/cmdline.c
@@ -71,8 +71,8 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
struct ctdb_context *ctdb;
int i, ret;
- if (ctdb_cmdline.nlist == NULL || ctdb_cmdline.myaddress == NULL) {
- printf("You must provide a node list with --nlist and an address with --listen\n");
+ if (ctdb_cmdline.nlist == NULL) {
+ printf("You must provide a node list with --nlist\n");
exit(1);
}
@@ -103,10 +103,12 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
}
/* tell ctdb what address to listen on */
- ret = ctdb_set_address(ctdb, ctdb_cmdline.myaddress);
- if (ret == -1) {
- printf("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb));
- exit(1);
+ if (ctdb_cmdline.myaddress) {
+ ret = ctdb_set_address(ctdb, ctdb_cmdline.myaddress);
+ if (ret == -1) {
+ printf("ctdb_set_address failed - %s\n", ctdb_errstr(ctdb));
+ exit(1);
+ }
}
/* tell ctdb the socket address */
@@ -123,10 +125,12 @@ struct ctdb_context *ctdb_cmdline_init(struct event_context *ev)
exit(1);
}
- ret = ctdb_set_tdb_dir(ctdb, ctdb_cmdline.db_dir);
- if (ret == -1) {
- printf("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb));
- exit(1);
+ if (ctdb_cmdline.db_dir) {
+ ret = ctdb_set_tdb_dir(ctdb, ctdb_cmdline.db_dir);
+ if (ret == -1) {
+ printf("ctdb_set_tdb_dir failed - %s\n", ctdb_errstr(ctdb));
+ exit(1);
+ }
}
/* initialize the vnn mapping table */