}
/* start the transport running */
- ctdb->methods->start(ctdb);
+ if (ctdb->methods->start(ctdb) != 0) {
+ DEBUG(0,("transport failed to start!\n"));
+ ctdb_fatal(ctdb, "transport failed to start");
+ }
/* go into a wait loop to allow other nodes to complete */
event_loop_wait(ctdb->ev);
return -1;
}
+#if 0
+ /* AIX doesn't like this :( */
if (fchown(ctdb->daemon.sd, geteuid(), getegid()) != 0 ||
fchmod(ctdb->daemon.sd, 0700) != 0) {
DEBUG(0,("Unable to secure ctdb socket '%s', ctdb->daemon.name\n"));
goto failed;
}
+#endif
set_non_blocking(ctdb->daemon.sd);
/*
start the protocol going as a daemon
*/
-int ctdb_start_daemon(struct ctdb_context *ctdb)
+int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
{
int res;
struct fd_event *fde;
exit(10);
}
- if (fork()) {
+ if (do_fork && fork()) {
return 0;
}
tdb_reopen_all(False);
- setsid();
+ if (do_fork) {
+ setsid();
+ }
block_signal(SIGPIPE);
block_signal(SIGCHLD);
int main(int argc, const char *argv[])
{
struct ctdb_context *ctdb;
+ int interactive = 0;
struct poptOption popt_options[] = {
POPT_AUTOHELP
POPT_CTDB_CMDLINE
+ { "interactive", 'i', POPT_ARG_NONE, &interactive, 0, "don't fork", NULL },
POPT_TABLEEND
};
int opt;
}
/* start the protocol running (as a child) */
- return ctdb_start_daemon(ctdb);
+ return ctdb_start_daemon(ctdb, interactive?False:True);
}
start the ctdb protocol
*/
int ctdb_start(struct ctdb_context *ctdb);
-int ctdb_start_daemon(struct ctdb_context *ctdb);
+int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork);
/*
attach to a ctdb database