mirror of
https://github.com/samba-team/samba.git
synced 2025-03-01 04:58:35 +03:00
messaging3: Make messaging_dgm_init return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Jun 18 21:17:57 CEST 2014 on sn-devel-104
This commit is contained in:
parent
b84ea45fbd
commit
364bdadde3
@ -73,9 +73,9 @@ struct messaging_backend {
|
||||
void *private_data;
|
||||
};
|
||||
|
||||
NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct messaging_backend **presult);
|
||||
int messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct messaging_backend **presult);
|
||||
int messaging_dgm_cleanup(struct messaging_context *msg_ctx, pid_t pid);
|
||||
int messaging_dgm_wipe(struct messaging_context *msg_ctx);
|
||||
void *messaging_dgm_register_tevent_context(TALLOC_CTX *mem_ctx,
|
||||
|
@ -209,6 +209,7 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
|
||||
{
|
||||
struct messaging_context *ctx;
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
static bool have_context = false;
|
||||
|
||||
if (have_context) {
|
||||
@ -225,11 +226,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
|
||||
ctx->event_ctx = ev;
|
||||
ctx->have_context = &have_context;
|
||||
|
||||
status = messaging_dgm_init(ctx, ctx, &ctx->local);
|
||||
ret = messaging_dgm_init(ctx, ctx, &ctx->local);
|
||||
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(2, ("messaging_dgm_init failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
if (ret != 0) {
|
||||
DEBUG(2, ("messaging_dgm_init failed: %s\n", strerror(ret)));
|
||||
TALLOC_FREE(ctx);
|
||||
return NULL;
|
||||
}
|
||||
@ -278,16 +278,16 @@ struct server_id messaging_server_id(const struct messaging_context *msg_ctx)
|
||||
NTSTATUS messaging_reinit(struct messaging_context *msg_ctx)
|
||||
{
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
|
||||
TALLOC_FREE(msg_ctx->local);
|
||||
|
||||
msg_ctx->id = procid_self();
|
||||
|
||||
status = messaging_dgm_init(msg_ctx, msg_ctx, &msg_ctx->local);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
DEBUG(0, ("messaging_dgm_init failed: %s\n",
|
||||
nt_errstr(status)));
|
||||
return status;
|
||||
ret = messaging_dgm_init(msg_ctx, msg_ctx, &msg_ctx->local);
|
||||
if (ret != 0) {
|
||||
DEBUG(0, ("messaging_dgm_init failed: %s\n", strerror(errno)));
|
||||
return map_nt_error_from_unix(ret);
|
||||
}
|
||||
|
||||
TALLOC_FREE(msg_ctx->remote);
|
||||
|
@ -165,9 +165,9 @@ static int messaging_dgm_lockfile_remove(TALLOC_CTX *tmp_ctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct messaging_backend **presult)
|
||||
int messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
TALLOC_CTX *mem_ctx,
|
||||
struct messaging_backend **presult)
|
||||
{
|
||||
struct messaging_backend *result;
|
||||
struct messaging_dgm_context *ctx;
|
||||
@ -182,8 +182,7 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
|
||||
cache_dir = lp_cache_directory();
|
||||
if (cache_dir == NULL) {
|
||||
NTSTATUS status = map_nt_error_from_unix(errno);
|
||||
return status;
|
||||
return errno;
|
||||
}
|
||||
|
||||
result = talloc(mem_ctx, struct messaging_backend);
|
||||
@ -214,7 +213,7 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
"%s/%u", socket_dir, (unsigned)pid.pid);
|
||||
if (sockname_len >= sizeof(socket_address.sun_path)) {
|
||||
TALLOC_FREE(result);
|
||||
return NT_STATUS_NAME_TOO_LONG;
|
||||
return ENAMETOOLONG;
|
||||
}
|
||||
|
||||
sec_init();
|
||||
@ -225,7 +224,7 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
DEBUG(1, ("%s: messaging_dgm_create_lockfile failed: %s\n",
|
||||
__func__, strerror(ret)));
|
||||
TALLOC_FREE(result);
|
||||
return map_nt_error_from_unix(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ctx->msg_callbacks = poll_funcs_init_tevent(ctx);
|
||||
@ -245,7 +244,7 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
if (!ok) {
|
||||
DEBUG(1, ("Could not create socket directory\n"));
|
||||
TALLOC_FREE(result);
|
||||
return NT_STATUS_ACCESS_DENIED;
|
||||
return EACCES;
|
||||
}
|
||||
TALLOC_FREE(socket_dir);
|
||||
|
||||
@ -258,16 +257,16 @@ NTSTATUS messaging_dgm_init(struct messaging_context *msg_ctx,
|
||||
if (ret != 0) {
|
||||
DEBUG(1, ("unix_msg_init failed: %s\n", strerror(ret)));
|
||||
TALLOC_FREE(result);
|
||||
return map_nt_error_from_unix(ret);
|
||||
return ret;
|
||||
}
|
||||
talloc_set_destructor(ctx, messaging_dgm_context_destructor);
|
||||
|
||||
*presult = result;
|
||||
return NT_STATUS_OK;
|
||||
return 0;
|
||||
|
||||
fail_nomem:
|
||||
TALLOC_FREE(result);
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
static int messaging_dgm_context_destructor(struct messaging_dgm_context *c)
|
||||
|
Loading…
x
Reference in New Issue
Block a user