[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 11/11] linux-user/syscall: simplify recvfrom()
From: |
Philippe Mathieu-Daudé |
Subject: |
[Qemu-devel] [PATCH 11/11] linux-user/syscall: simplify recvfrom() |
Date: |
Wed, 24 Jan 2018 10:01:26 -0300 |
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
linux-user/syscall.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b6b9beca5b..e082af2911 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4023,8 +4023,8 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t
len, int flags,
abi_ulong target_addr,
abi_ulong target_addrlen)
{
- socklen_t addrlen;
- void *addr;
+ socklen_t addrlen = 0;
+ void *addr = NULL;
void *host_msg;
abi_long ret;
@@ -4046,12 +4046,9 @@ static abi_long do_recvfrom(int fd, abi_ulong msg,
size_t len, int flags,
}
addr = alloca(addrlen);
- ret = get_errno(safe_recvfrom(fd, host_msg, len, flags,
- addr, &addrlen));
- } else {
- addr = NULL; /* To keep compiler quiet. */
- ret = get_errno(safe_recvfrom(fd, host_msg, len, flags, NULL, 0));
}
+ ret = get_errno(safe_recvfrom(fd, host_msg, len, flags, addr, &addrlen));
+
if (!is_error(ret)) {
if (fd_trans_host_to_target_data(fd)) {
ret = fd_trans_host_to_target_data(fd)(host_msg, ret);
--
2.15.1
- [Qemu-devel] [PATCH 00/11] linux-user: improve NETLINK strace, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 02/11] linux-user/strace: improve sendto() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [RFC PATCH 01/11] linux-user/strace: dump AF_NETLINK sockaddr content, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 04/11] linux-user/strace: improve recvfrom() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 03/11] linux-user/strace: add print_sockaddr_ptr() to handle plain/pointer addrlen, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 06/11] linux-user/strace: improve recvmsg() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 05/11] linux-user/strace: improve getsockname() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 07/11] linux-user/strace: improve bind() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 11/11] linux-user/syscall: simplify recvfrom(),
Philippe Mathieu-Daudé <=
- [Qemu-devel] [PATCH 09/11] linux-user/strace: improve capget()/capset() output, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 10/11] linux-user/syscall: verify recvfrom(addr) is user-writable, Philippe Mathieu-Daudé, 2018/01/24
- [Qemu-devel] [PATCH 08/11] linux-user/strace: improve gettimeofday() output, Philippe Mathieu-Daudé, 2018/01/24
- Re: [Qemu-devel] [PATCH 00/11] linux-user: improve NETLINK strace, Guido Günther, 2018/01/24
- Re: [Qemu-devel] [PATCH 00/11] linux-user: improve NETLINK strace, Guido Günther, 2018/01/28