From 8fea36025b9d6d360ff3b78f88a84ccf221807e8 Mon Sep 17 00:00:00 2001 From: aurel32 Date: Fri, 30 Jan 2009 19:47:47 +0000 Subject: linux-user: fix accept(2) with NULL peer Based on scratchbox2 patch by Mika Westerberg Signed-off-by: Riku Voipio Signed-off-by: Aurelien Jarno git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6478 c046a42c-6fe2-441c-8c8c-71466251a162 --- linux-user/syscall.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'linux-user/syscall.c') diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 5d787bb753..dce5cad594 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1267,6 +1267,9 @@ static abi_long do_getsockname(int fd, abi_ulong target_addr, void *addr; abi_long ret; + if (target_addr == 0) + return get_errno(accept(fd, NULL, NULL)); + if (get_user_u32(addrlen, target_addrlen_addr)) return -TARGET_EFAULT; -- cgit v1.2.3