summaryrefslogtreecommitdiffstats
path: root/source3/lib
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-10-04 10:40:24 +0200
committerStefan Metzmacher <metze@samba.org>2015-02-13 23:32:06 +0100
commit293a602b33f07ecf75f1ea4956c012261a6f2ae5 (patch)
tree8016101432706352e5afd81fc524e517ed12b426 /source3/lib
parent5f66ddf094f0957062f8bd2352bf9c53938dc586 (diff)
downloadsamba-293a602b33f07ecf75f1ea4956c012261a6f2ae5.tar.gz
samba-293a602b33f07ecf75f1ea4956c012261a6f2ae5.tar.xz
samba-293a602b33f07ecf75f1ea4956c012261a6f2ae5.zip
messages_dgm: Only pass "unique" to messaging_dgm_init
We have only one context per pid, so messaging_dgm_init can do getpid() itself. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/messages.c4
-rw-r--r--source3/lib/messages_dgm.c10
-rw-r--r--source3/lib/messages_dgm.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 0e5358349d..f14d14961c 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -307,7 +307,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
sec_init();
- ret = messaging_dgm_init(ctx->event_ctx, ctx->id,
+ ret = messaging_dgm_init(ctx->event_ctx, ctx->id.unique_id,
lp_cache_directory(), sec_initial_uid(),
messaging_recv_cb, ctx);
@@ -368,7 +368,7 @@ NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
msg_ctx->id = procid_self();
- ret = messaging_dgm_init(msg_ctx->event_ctx, msg_ctx->id,
+ ret = messaging_dgm_init(msg_ctx->event_ctx, msg_ctx->id.unique_id,
lp_cache_directory(), sec_initial_uid(),
messaging_recv_cb, msg_ctx);
if (ret != 0) {
diff --git a/source3/lib/messages_dgm.c b/source3/lib/messages_dgm.c
index ae35282b4a..8f5ac4dc37 100644
--- a/source3/lib/messages_dgm.c
+++ b/source3/lib/messages_dgm.c
@@ -176,7 +176,7 @@ static int messaging_dgm_lockfile_remove(const char *cache_dir, pid_t pid)
}
int messaging_dgm_init(struct tevent_context *ev,
- struct server_id pid,
+ uint64_t unique,
const char *cache_dir,
uid_t dir_owner,
void (*recv_cb)(const uint8_t *msg,
@@ -203,7 +203,7 @@ int messaging_dgm_init(struct tevent_context *ev,
if (ctx == NULL) {
goto fail_nomem;
}
- ctx->pid = pid.pid;
+ ctx->pid = getpid();
ctx->recv_cb = recv_cb;
ctx->recv_cb_private_data = recv_cb_private_data;
@@ -220,14 +220,14 @@ int messaging_dgm_init(struct tevent_context *ev,
socket_address = (struct sockaddr_un) { .sun_family = AF_UNIX };
sockname_len = snprintf(socket_address.sun_path,
sizeof(socket_address.sun_path),
- "%s/%u", socket_dir.buf, (unsigned)pid.pid);
+ "%s/%u", socket_dir.buf, (unsigned)ctx->pid);
if (sockname_len >= sizeof(socket_address.sun_path)) {
TALLOC_FREE(ctx);
return ENAMETOOLONG;
}
- ret = messaging_dgm_lockfile_create(cache_dir, dir_owner, pid.pid,
- &ctx->lockfile_fd, pid.unique_id);
+ ret = messaging_dgm_lockfile_create(cache_dir, dir_owner, ctx->pid,
+ &ctx->lockfile_fd, unique);
if (ret != 0) {
DEBUG(1, ("%s: messaging_dgm_create_lockfile failed: %s\n",
__func__, strerror(ret)));
diff --git a/source3/lib/messages_dgm.h b/source3/lib/messages_dgm.h
index 00ff56f30c..9d01976439 100644
--- a/source3/lib/messages_dgm.h
+++ b/source3/lib/messages_dgm.h
@@ -21,7 +21,7 @@
#define _MESSAGES_DGM_H_
int messaging_dgm_init(struct tevent_context *ev,
- struct server_id pid,
+ uint64_t unique,
const char *cache_dir,
uid_t dir_owner,
void (*recv_cb)(const uint8_t *msg,