diff options
author | Stefan Metzmacher <metze@samba.org> | 2014-08-06 09:40:56 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-09-24 08:44:11 +0200 |
commit | eca6d83a5f2fb7f85da7067868fdd6143ae726ff (patch) | |
tree | ce5c40eeb1f18d0d10fe5bd06762c357be219247 /source3/lib/unix_msg | |
parent | fbcd912bb6114d203a8645e9aec1c6134e9ebf3f (diff) | |
download | samba-eca6d83a5f2fb7f85da7067868fdd6143ae726ff.tar.gz samba-eca6d83a5f2fb7f85da7067868fdd6143ae726ff.tar.xz samba-eca6d83a5f2fb7f85da7067868fdd6143ae726ff.zip |
s3:unix_msg: use sendmsg() in unix_dgram_send_job()
This prepares fd-passing.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Diffstat (limited to 'source3/lib/unix_msg')
-rw-r--r-- | source3/lib/unix_msg/unix_msg.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/lib/unix_msg/unix_msg.c b/source3/lib/unix_msg/unix_msg.c index 982ae46cd0..8346bb54c5 100644 --- a/source3/lib/unix_msg/unix_msg.c +++ b/source3/lib/unix_msg/unix_msg.c @@ -416,11 +416,19 @@ static int queue_msg(struct unix_dgram_send_queue *q, static void unix_dgram_send_job(void *private_data) { - struct unix_dgram_msg *msg = private_data; + struct unix_dgram_msg *dmsg = private_data; + struct iovec iov = { + .iov_base = (void *)dmsg->buf, + .iov_len = dmsg->buflen, + }; + struct msghdr msg = { + .msg_iov = &iov, + .msg_iovlen = 1, + }; do { - msg->sent = send(msg->sock, msg->buf, msg->buflen, 0); - } while ((msg->sent == -1) && (errno == EINTR)); + dmsg->sent = sendmsg(dmsg->sock, &msg, 0); + } while ((dmsg->sent == -1) && (errno == EINTR)); } static void unix_dgram_job_finished(struct poll_watch *w, int fd, short events, |