Commit 6de645c7d1f2dfce6df9823ef599b1bb4ef87d9a

Authored by balrog
1 parent 55f280c9

Recvmsg must return the number of bytes received (Lauro Ramos Venancio).


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5564 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 6 additions and 2 deletions
linux-user/syscall.c
@@ -1160,7 +1160,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr, @@ -1160,7 +1160,7 @@ static abi_long do_connect(int sockfd, abi_ulong target_addr,
1160 static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, 1160 static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
1161 int flags, int send) 1161 int flags, int send)
1162 { 1162 {
1163 - abi_long ret; 1163 + abi_long ret, len;
1164 struct target_msghdr *msgp; 1164 struct target_msghdr *msgp;
1165 struct msghdr msg; 1165 struct msghdr msg;
1166 int count; 1166 int count;
@@ -1199,8 +1199,12 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg, @@ -1199,8 +1199,12 @@ static abi_long do_sendrecvmsg(int fd, abi_ulong target_msg,
1199 ret = get_errno(sendmsg(fd, &msg, flags)); 1199 ret = get_errno(sendmsg(fd, &msg, flags));
1200 } else { 1200 } else {
1201 ret = get_errno(recvmsg(fd, &msg, flags)); 1201 ret = get_errno(recvmsg(fd, &msg, flags));
1202 - if (!is_error(ret)) 1202 + if (!is_error(ret)) {
  1203 + len = ret;
1203 ret = host_to_target_cmsg(msgp, &msg); 1204 ret = host_to_target_cmsg(msgp, &msg);
  1205 + if (!is_error(ret))
  1206 + ret = len;
  1207 + }
1204 } 1208 }
1205 unlock_iovec(vec, target_vec, count, !send); 1209 unlock_iovec(vec, target_vec, count, !send);
1206 unlock_user_struct(msgp, target_msg, send ? 0 : 1); 1210 unlock_user_struct(msgp, target_msg, send ? 0 : 1);