1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

lib: Make ctdbd_messaging_connection return 0/errno

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2015-10-02 20:42:05 -07:00 committed by Jeremy Allison
parent 9da6cce5c0
commit 546d8b4129
3 changed files with 18 additions and 21 deletions

View File

@ -26,9 +26,9 @@ struct ctdbd_connection;
struct messaging_context;
struct messaging_rec;
NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
const char *sockname, int timeout,
struct ctdbd_connection **pconn);
int ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
const char *sockname, int timeout,
struct ctdbd_connection **pconn);
uint32_t ctdbd_vnn(const struct ctdbd_connection *conn);

View File

@ -485,32 +485,30 @@ static int ctdbd_init_connection(TALLOC_CTX *mem_ctx,
* Get us a ctdbd connection and register us as a process
*/
NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
const char *sockname, int timeout,
struct ctdbd_connection **pconn)
int ctdbd_messaging_connection(TALLOC_CTX *mem_ctx,
const char *sockname, int timeout,
struct ctdbd_connection **pconn)
{
struct ctdbd_connection *conn;
NTSTATUS status;
int ret;
ret = ctdbd_init_connection(mem_ctx, sockname, timeout, &conn);
if (ret != 0) {
return map_nt_error_from_unix(ret);
return ret;
}
ret = register_with_ctdbd(conn, MSG_SRVID_SAMBA, NULL, NULL);
if (ret != 0) {
status = map_nt_error_from_unix(ret);
goto fail;
}
*pconn = conn;
return NT_STATUS_OK;
return 0;
fail:
TALLOC_FREE(conn);
return status;
return ret;
}
struct messaging_context *ctdb_conn_msg_ctx(struct ctdbd_connection *conn)
@ -1322,15 +1320,15 @@ NTSTATUS ctdbd_probe(const char *sockname, int timeout)
* later
*/
struct ctdbd_connection *conn = NULL;
NTSTATUS status;
int ret;
status = ctdbd_messaging_connection(talloc_tos(), sockname, timeout,
&conn);
ret = ctdbd_messaging_connection(talloc_tos(), sockname, timeout,
&conn);
/*
* We only care if we can connect.
*/
TALLOC_FREE(conn);
return status;
return map_nt_error_from_unix(ret);
}

View File

@ -170,7 +170,6 @@ NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
{
struct messaging_backend *result;
struct messaging_ctdbd_context *ctx;
NTSTATUS status;
int ret;
if (!(result = talloc(mem_ctx, struct messaging_backend))) {
@ -184,14 +183,14 @@ NTSTATUS messaging_ctdbd_init(struct messaging_context *msg_ctx,
return NT_STATUS_NO_MEMORY;
}
status = ctdbd_messaging_connection(ctx, lp_ctdbd_socket(),
lp_ctdb_timeout(), &ctx->conn);
ret = ctdbd_messaging_connection(ctx, lp_ctdbd_socket(),
lp_ctdb_timeout(), &ctx->conn);
if (!NT_STATUS_IS_OK(status)) {
if (ret != 0) {
DEBUG(10, ("ctdbd_messaging_connection failed: %s\n",
nt_errstr(status)));
strerror(ret)));
TALLOC_FREE(result);
return status;
return map_nt_error_from_unix(ret);
}
ret = ctdbd_register_msg_ctx(ctx->conn, msg_ctx);