summaryrefslogtreecommitdiffstats
path: root/source3/lib/messages_ctdbd.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-12-06 11:22:35 +0100
committerJeremy Allison <jra@samba.org>2014-12-09 04:12:08 +0100
commitd775c386e498d4c2062f8fc65f515f991d127dc1 (patch)
tree46bc6a9e8ec84b31d7a6f13138d8a6715a141423 /source3/lib/messages_ctdbd.c
parent3a6a6f19410606a9028861ca95ac80d2651e2830 (diff)
downloadsamba-d775c386e498d4c2062f8fc65f515f991d127dc1.tar.gz
samba-d775c386e498d4c2062f8fc65f515f991d127dc1.tar.xz
samba-d775c386e498d4c2062f8fc65f515f991d127dc1.zip
lib: Simplify iov_buf[len]
This makes iov_buf independent of talloc Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/messages_ctdbd.c')
-rw-r--r--source3/lib/messages_ctdbd.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/lib/messages_ctdbd.c b/source3/lib/messages_ctdbd.c
index 59f5976da0..53aeb1fd05 100644
--- a/source3/lib/messages_ctdbd.c
+++ b/source3/lib/messages_ctdbd.c
@@ -100,16 +100,23 @@ static int messaging_ctdb_send(struct server_id src,
backend->private_data, struct messaging_ctdbd_context);
struct messaging_rec msg;
uint8_t *buf;
+ ssize_t buflen;
NTSTATUS status;
if (num_fds > 0) {
return ENOSYS;
}
- buf = iov_buf(talloc_tos(), iov, iovlen);
- if (buf == NULL) {
+ buflen = iov_buflen(iov, iovlen);
+ if (buflen == -1) {
+ return EMSGSIZE;
+ }
+
+ buf = talloc_array(talloc_tos(), uint8_t, buflen);
+ if (buflen == NULL) {
return ENOMEM;
}
+ iov_buf(iov, iovlen, buf, buflen);
msg = (struct messaging_rec) {
.msg_version = MESSAGE_VERSION,