mirror of
https://github.com/samba-team/samba.git
synced 2025-03-23 06:50:21 +03:00
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>
This commit is contained in:
parent
d775c386e4
commit
dc38f646af
@ -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;
|
||||
}
|
||||
|
@ -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',
|
||||
|
Loading…
x
Reference in New Issue
Block a user