Signed-off-by: Philippe Mathieu-Daudé <f4...@amsat.org> --- 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