Commit 8fea36025b9d6d360ff3b78f88a84ccf221807e8

Authored by aurel32
1 parent 08a2d4c4

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
Showing 1 changed file with 3 additions and 0 deletions
linux-user/syscall.c
... ... @@ -1267,6 +1267,9 @@ static abi_long do_getsockname(int fd, abi_ulong target_addr,
1267 1267 void *addr;
1268 1268 abi_long ret;
1269 1269  
  1270 + if (target_addr == 0)
  1271 + return get_errno(accept(fd, NULL, NULL));
  1272 +
1270 1273 if (get_user_u32(addrlen, target_addrlen_addr))
1271 1274 return -TARGET_EFAULT;
1272 1275  
... ...