linux-user: fix accept(2) with NULL peer

Based on scratchbox2 patch by Mika Westerberg

Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6478 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
aurel32 2009-01-30 19:47:47 +00:00
parent 08a2d4c4ff
commit 8fea36025b

View File

@ -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;