initial import
[patches.git] / qemu-socklen-t.patch
1 --- linux-user/syscall.c
2 +++ linux-user/syscall.c
3 @@ -642,7 +642,8 @@ static long do_setsockopt(int sockfd, in
4 static long do_getsockopt(int sockfd, int level, int optname,
5 target_ulong optval, target_ulong optlen)
6 {
7 - int len, lv, val, ret;
8 + int len, val, ret;
9 + socklen_t lv;
10
11 switch(level) {
12 case TARGET_SOL_SOCKET:
13 @@ -665,7 +666,7 @@ static long do_getsockopt(int sockfd, in
14 len = tget32(optlen);
15 if (len < 0)
16 return -EINVAL;
17 - lv = sizeof(int);
18 + lv = sizeof(val);
19 ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv));
20 if (ret < 0)
21 return ret;
22 @@ -698,7 +699,7 @@ static long do_getsockopt(int sockfd, in
23 len = tget32(optlen);
24 if (len < 0)
25 return -EINVAL;
26 - lv = sizeof(int);
27 + lv = sizeof(val);
28 ret = get_errno(getsockopt(sockfd, level, optname, &val, &lv));
29 if (ret < 0)
30 return ret;