From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:34630) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsH1o-00072x-Ep for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:32:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SsGzw-0006Rz-CP for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:30:12 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:41842) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SsGzw-0006Rp-6f for qemu-devel@nongnu.org; Fri, 20 Jul 2012 13:28:16 -0400 Received: by pbbro12 with SMTP id ro12so6432200pbb.4 for ; Fri, 20 Jul 2012 10:28:15 -0700 (PDT) From: Jing Huang Date: Sat, 21 Jul 2012 01:28:57 +0000 Message-Id: <1342834137-2629-1-git-send-email-jing.huang.pku@gmail.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH V3 1/3] linux-user: pass sockaddr from host to target List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, riku.voipio@iki.fi, jing.huang.pku@gmail.com Signed-off-by: Jing Huang --- linux-user/syscall.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 539af3f..82aa83d 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1873,10 +1873,21 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, if (!is_error(ret)) { len = ret; ret = host_to_target_cmsg(msgp, &msg); - if (!is_error(ret)) + if (!is_error(ret)) { + msgp->msg_namelen = tswap32(msg.msg_namelen); + if (msg.msg_name != NULL) { + ret = host_to_target_sockaddr(tswapal(msgp->msg_name), + msg.msg_name, msg.msg_namelen); + if (ret) { + goto out; + } + } + ret = len; + } } } +out: unlock_iovec(vec, target_vec, count, !send); unlock_user_struct(msgp, target_msg, send ? 0 : 1); return ret; -- 1.7.8.6