summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2015-10-02 20:42:05 -0700
committerJeremy Allison <jra@samba.org>2015-10-07 23:54:06 +0200
commit2bc55c5321a44e439a2e00309e979c0188c3fc75 (patch)
tree4b960f74849b3663b945739a294df72ca8ff2e50
parent678ad954e8734fce52d283e95c0b7c5c9d0d1318 (diff)
downloadsamba-2bc55c5321a44e439a2e00309e979c0188c3fc75.tar.gz
lib: Make messaging_send_iov_from return 0/errno
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/include/messages.h10
-rw-r--r--source3/lib/messages.c36
-rw-r--r--source3/lib/messages_ctdbd.c10
-rw-r--r--source3/smbd/notifyd/notifyd.c8
4 files changed, 32 insertions, 32 deletions
diff --git a/source3/include/messages.h b/source3/include/messages.h
index 5ad155b5d56..9a3ea25b649 100644
--- a/source3/include/messages.h
+++ b/source3/include/messages.h
@@ -123,11 +123,11 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx,
NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
const uint8_t *buf, size_t len);
-NTSTATUS messaging_send_iov_from(struct messaging_context *msg_ctx,
- struct server_id src, struct server_id dst,
- uint32_t msg_type,
- const struct iovec *iov, int iovlen,
- const int *fds, size_t num_fds);
+int messaging_send_iov_from(struct messaging_context *msg_ctx,
+ struct server_id src, struct server_id dst,
+ uint32_t msg_type,
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds);
NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
struct server_id server, uint32_t msg_type,
const struct iovec *iov, int iovlen,
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 717cd4c1c5f..03e60975b0e 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -518,37 +518,34 @@ NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx,
return messaging_send(msg_ctx, server, msg_type, &blob);
}
-NTSTATUS messaging_send_iov_from(struct messaging_context *msg_ctx,
- struct server_id src, struct server_id dst,
- uint32_t msg_type,
- const struct iovec *iov, int iovlen,
- const int *fds, size_t num_fds)
+int messaging_send_iov_from(struct messaging_context *msg_ctx,
+ struct server_id src, struct server_id dst,
+ uint32_t msg_type,
+ const struct iovec *iov, int iovlen,
+ const int *fds, size_t num_fds)
{
int ret;
uint8_t hdr[MESSAGE_HDR_LENGTH];
struct iovec iov2[iovlen+1];
if (server_id_is_disconnected(&dst)) {
- return NT_STATUS_INVALID_PARAMETER_MIX;
+ return EINVAL;
}
if (num_fds > INT8_MAX) {
- return NT_STATUS_INVALID_PARAMETER_MIX;
+ return EINVAL;
}
if (!procid_is_local(&dst)) {
if (num_fds > 0) {
- return NT_STATUS_NOT_SUPPORTED;
+ return ENOSYS;
}
ret = msg_ctx->remote->send_fn(src, dst,
msg_type, iov, iovlen,
NULL, 0,
msg_ctx->remote);
- if (ret != 0) {
- return map_nt_error_from_unix(ret);
- }
- return NT_STATUS_OK;
+ return ret;
}
message_hdr_put(hdr, msg_type, src, dst);
@@ -559,10 +556,7 @@ NTSTATUS messaging_send_iov_from(struct messaging_context *msg_ctx,
ret = messaging_dgm_send(dst.pid, iov2, iovlen+1, fds, num_fds);
unbecome_root();
- if (ret != 0) {
- return map_nt_error_from_unix(ret);
- }
- return NT_STATUS_OK;
+ return ret;
}
NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
@@ -570,8 +564,14 @@ NTSTATUS messaging_send_iov(struct messaging_context *msg_ctx,
const struct iovec *iov, int iovlen,
const int *fds, size_t num_fds)
{
- return messaging_send_iov_from(msg_ctx, msg_ctx->id, dst, msg_type,
- iov, iovlen, fds, num_fds);
+ int ret;
+
+ ret = messaging_send_iov_from(msg_ctx, msg_ctx->id, dst, msg_type,
+ iov, iovlen, fds, num_fds);
+ if (ret != 0) {
+ return map_nt_error_from_unix(ret);
+ }
+ return NT_STATUS_OK;
}
static struct messaging_rec *messaging_rec_dup(TALLOC_CTX *mem_ctx,
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 90bae76c8c5..48563a832cd 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -112,7 +112,7 @@ static int messaging_ctdb_recv(
struct messaging_context *msg_ctx = talloc_get_type_abort(
private_data, struct messaging_context);
struct server_id me = messaging_server_id(msg_ctx);
- NTSTATUS status;
+ int ret;
struct iovec iov;
struct server_id src, dst;
enum messaging_type msg_type;
@@ -148,12 +148,12 @@ static int messaging_ctdb_recv(
* Go through the event loop
*/
- status = messaging_send_iov_from(msg_ctx, src, dst, msg_type,
- &iov, 1, NULL, 0);
+ ret = messaging_send_iov_from(msg_ctx, src, dst, msg_type,
+ &iov, 1, NULL, 0);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
DEBUG(10, ("%s: messaging_send_iov_from failed: %s\n",
- __func__, nt_errstr(status)));
+ __func__, strerror(ret)));
}
return 0;
diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c
index 06f48cf2b59..141556da94a 100644
--- a/source3/smbd/notifyd/notifyd.c
+++ b/source3/smbd/notifyd/notifyd.c
@@ -791,7 +791,7 @@ static void notifyd_send_delete(struct messaging_context *msg_ctx,
};
uint8_t nul = 0;
struct iovec iov[3];
- NTSTATUS status;
+ int ret;
/*
* Send a rec_change to ourselves to delete a dead entry
@@ -803,13 +803,13 @@ static void notifyd_send_delete(struct messaging_context *msg_ctx,
iov[1] = (struct iovec) { .iov_base = key.dptr, .iov_len = key.dsize };
iov[2] = (struct iovec) { .iov_base = &nul, .iov_len = sizeof(nul) };
- status = messaging_send_iov_from(
+ ret = messaging_send_iov_from(
msg_ctx, instance->client, messaging_server_id(msg_ctx),
MSG_SMB_NOTIFY_REC_CHANGE, iov, ARRAY_SIZE(iov), NULL, 0);
- if (!NT_STATUS_IS_OK(status)) {
+ if (ret != 0) {
DEBUG(10, ("%s: messaging_send_iov_from returned %s\n",
- __func__, nt_errstr(status)));
+ __func__, strerror(ret)));
}
}