summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2009-01-15 15:52:41 -0800
committerJeremy Allison <jra@samba.org>2009-01-15 15:52:41 -0800
commit6fd867f036b0dfbc4d6639c737467132b41dd2e5 (patch)
tree4dd1fb5c6fdb39feca8454514caea4ec92cfc0c1 /source3
parent9361c73c2f4ce9a2f9a7e5515a9272ddd14eb2ed (diff)
downloadsamba-6fd867f036b0dfbc4d6639c737467132b41dd2e5.tar.gz
samba-6fd867f036b0dfbc4d6639c737467132b41dd2e5.tar.bz2
samba-6fd867f036b0dfbc4d6639c737467132b41dd2e5.zip
Allow reinit_after_fork to be called safely from within swat and other binaries that don't have
an event context or a msg context. Fixes crash bug in swat. Jeremy.
Diffstat (limited to 'source3')
-rw-r--r--source3/lib/util.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 1e6ee56230..70eabbfa99 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -966,18 +966,22 @@ bool reinit_after_fork(struct messaging_context *msg_ctx,
return false;
}
- /*
- * For clustering, we need to re-init our ctdbd connection after the
- * fork
- */
- status = messaging_reinit(msg_ctx);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("messaging_reinit() failed: %s\n",
- nt_errstr(status)));
- return false;
+ if (msg_ctx) {
+ /*
+ * For clustering, we need to re-init our ctdbd connection after the
+ * fork
+ */
+ status = messaging_reinit(msg_ctx);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("messaging_reinit() failed: %s\n",
+ nt_errstr(status)));
+ return false;
+ }
}
- event_context_reinit(ev_ctx);
+ if (ev_ctx) {
+ event_context_reinit(ev_ctx);
+ }
return true;
}