From: Chen Gang <cheng...@emindsoft.com.cn>

After host_to_target_sock_type(), the length of val may be changed, so
calculate the related lv, too.

Signed-off-by: Chen Gang <gang.chen.5...@gmail.com>
---
 linux-user/syscall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index fcdca2a..0e95f35 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1841,6 +1841,7 @@ static abi_long do_getsockopt(int sockfd, int level, int 
optname,
             return ret;
         if (optname == SO_TYPE) {
             val = host_to_target_sock_type(val);
+            lv = (val >> 8) ? 4 : 1;
         }
         if (len > lv)
             len = lv;
-- 
1.9.1


Reply via email to