diff options
author | Volker Lendecke <vl@samba.org> | 2014-12-06 11:28:16 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-12-09 04:12:08 +0100 |
commit | dc38f646af4582a3adffda20d7bb0e449df5e22e (patch) | |
tree | 1668926ffe19ea00eebbec4991de5eeadca967a4 | |
parent | d775c386e498d4c2062f8fc65f515f991d127dc1 (diff) | |
download | samba-dc38f646af4582a3adffda20d7bb0e449df5e22e.tar.gz samba-dc38f646af4582a3adffda20d7bb0e449df5e22e.tar.xz samba-dc38f646af4582a3adffda20d7bb0e449df5e22e.zip |
lib: Use iov_buf in unix_msg
Now that iov_buf does not pull in talloc we can use it
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/lib/unix_msg/unix_msg.c | 25 | ||||
-rw-r--r-- | source3/lib/unix_msg/wscript_build | 2 |
2 files changed, 3 insertions, 24 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c index 7ca506a85c..78b29c2d07 100644 --- a/source3/lib/unix_msg/unix_msg.c +++ b/source3/lib/unix_msg/unix_msg.c @@ -23,6 +23,7 @@ #include "system/network.h" #include "dlinklist.h" #include "pthreadpool/pthreadpool.h" +#include "lib/iov_buf.h" #include <fcntl.h> /* @@ -77,7 +78,6 @@ struct unix_dgram_ctx { char path[]; }; -static ssize_t iov_buflen(const struct iovec *iov, int iovlen); static void unix_dgram_recv_handler(struct poll_watch *w, int fd, short events, void *private_data); @@ -583,10 +583,7 @@ static int queue_msg(struct unix_dgram_send_queue *q, } #endif /* HAVE_STRUCT_MSGHDR_MSG_CONTROL */ - for (i=0; i<iovlen; i++) { - memcpy(data_buf, iov[i].iov_base, iov[i].iov_len); - data_buf += iov[i].iov_len; - } + iov_buf(iov, iovlen, data_buf, data_len); DLIST_ADD_END(q->msgs, msg, struct unix_dgram_msg); return 0; @@ -1106,21 +1103,3 @@ int unix_msg_free(struct unix_msg_ctx *ctx) free(ctx); return 0; } - -static ssize_t iov_buflen(const struct iovec *iov, int iovlen) -{ - size_t buflen = 0; - int i; - - for (i=0; i<iovlen; i++) { - size_t thislen = iov[i].iov_len; - size_t tmp = buflen + thislen; - - if ((tmp < buflen) || (tmp < thislen)) { - /* overflow */ - return -1; - } - buflen = tmp; - } - return buflen; -} diff --git a/source3/lib/unix_msg/wscript_build b/source3/lib/unix_msg/wscript_build index 200840d026..e638ea677d 100644 --- a/source3/lib/unix_msg/wscript_build +++ b/source3/lib/unix_msg/wscript_build @@ -2,7 +2,7 @@ bld.SAMBA3_SUBSYSTEM('UNIX_MSG', source='unix_msg.c', - deps='replace PTHREADPOOL') + deps='replace PTHREADPOOL iov_buf') bld.SAMBA3_BINARY('unix_msg_test', source='tests.c', |