diff options
author | Stefan Metzmacher <metze@samba.org> | 2008-04-15 01:18:50 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2008-04-18 14:43:07 +0200 |
commit | 4f6089be35d5388695f5fcd89890756e17237e6c (patch) | |
tree | b93735ca909cc5a0a0f3b1f64859aefb7dd28df9 | |
parent | b86b442a1e8a49d32a4b7cb44a9f6b5e270be403 (diff) | |
download | samba-4f6089be35d5388695f5fcd89890756e17237e6c.tar.gz samba-4f6089be35d5388695f5fcd89890756e17237e6c.tar.bz2 samba-4f6089be35d5388695f5fcd89890756e17237e6c.zip |
messages_ctdbd: autocreate a ctdb connection, this will fix segfaults in the client tools
metze
(This used to be commit 6f67c4ddf8101b1d06889055e3767a6ce0db360c)
-rw-r--r-- | source3/lib/messages_ctdbd.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c index 0c8a2aa8e4..a01c5e03a2 100644 --- a/source3/lib/messages_ctdbd.c +++ b/source3/lib/messages_ctdbd.c @@ -40,6 +40,24 @@ static int global_ctdb_connection_pid; struct ctdbd_connection *messaging_ctdbd_connection(void) { + if (global_ctdb_connection_pid == 0 && + global_ctdbd_connection == NULL) { + struct event_context *ev; + struct messaging_context *msg; + + ev = event_context_init(NULL); + if (!msg) { + DEBUG(0,("event_context_init failed\n")); + } + + msg = messaging_init(NULL, procid_self(), ev); + if (!msg) { + DEBUG(0,("messaging_init failed\n")); + } + + db_tdb2_setup_messaging(msg, false); + } + if (global_ctdb_connection_pid != getpid()) { DEBUG(0,("messaging_ctdbd_connection():" "valid for pid[%d] but it's [%d]\n", |