summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/lib/messages_ctdbd.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index f1a02e6af9..0c8a2aa8e4 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -35,10 +35,18 @@ struct messaging_ctdbd_context {
* This is a Samba3 hack/optimization. Routines like process_exists need to
* talk to ctdbd, and they don't get handed a messaging context.
*/
-struct ctdbd_connection *global_ctdbd_connection;
+static struct ctdbd_connection *global_ctdbd_connection;
+static int global_ctdb_connection_pid;
struct ctdbd_connection *messaging_ctdbd_connection(void)
{
+ if (global_ctdb_connection_pid != getpid()) {
+ DEBUG(0,("messaging_ctdbd_connection():"
+ "valid for pid[%d] but it's [%d]\n",
+ global_ctdb_connection_pid, getpid()));
+ smb_panic("messaging_ctdbd_connection() invalid process\n");
+ }
+
return global_ctdbd_connection;
}
@@ -66,6 +74,7 @@ static int messaging_ctdbd_destructor(struct messaging_ctdbd_context *ctx)
/*
* The global connection just went away
*/
+ global_ctdb_connection_pid = 0;
global_ctdbd_connection = NULL;
return 0;
}
@@ -107,6 +116,7 @@ NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
return status;
}
+ global_ctdb_connection_pid = getpid();
global_ctdbd_connection = ctx->conn;
talloc_set_destructor(ctx, messaging_ctdbd_destructor);